From 1107a7f2bbc07ed469121325e947d5e62360f652 Mon Sep 17 00:00:00 2001 From: Felix Pankratz Date: Thu, 24 Jul 2025 23:09:40 +0200 Subject: [PATCH] time based lighting --- kglobe.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kglobe.py b/kglobe.py index cd56d34..a4577ce 100644 --- a/kglobe.py +++ b/kglobe.py @@ -12,6 +12,7 @@ import argparse import asyncio import os import IP2Location +from datetime import timezone, datetime from terminalplotter import TerminalPlotter @@ -157,7 +158,7 @@ async def main(): width, height = args.size else: height, width = await kitty.get_terminal_size_pixel() - plotter = TerminalPlotter(width, height) + plotter = TerminalPlotter(width, height, lighting='none') plotter.add_mesh( globe, color="tan", smooth_shading=False, texture=tex, show_edges=False ) @@ -185,6 +186,12 @@ async def main(): color = "red" plotter.add_mesh(line, color=color, line_width=2) + now = datetime.now(timezone.utc) + sun_angle = (now.hour - 12) * (360/24) + light = pv.Light() + light.set_direction_angle(0.55864, sun_angle) + plotter.add_light(light) + kitty.hide_cursor() try: await plotter.run()