From 8f679c53374f5ea5f7239923ccab75bf0ae062e7 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial Date: Wed, 9 Apr 2025 21:50:59 -0400 Subject: [PATCH] Ensure city names are rendered correctly in dark mode --- lib/xmet/map.py | 8 ++++++-- lib/xmet/spc.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/xmet/map.py b/lib/xmet/map.py index 9f8d78d..952f7f6 100644 --- a/lib/xmet/map.py +++ b/lib/xmet/map.py @@ -78,7 +78,7 @@ class EquirectMap(): else: cr.line_to(x, y) - def draw_city(self, cr: cairo.Context, city: City): + def draw_city(self, cr: cairo.Context, city: City, dark: bool=False): cr.save() x, y = self.map_to_screen(city.location) @@ -96,7 +96,11 @@ class EquirectMap(): extents = cr.text_extents(city.name) - cr.set_source_rgb(0.2, 0.2, 0.2) + if dark: + cr.set_source_rgb(0.9, 0.9, 0.9) + else: + cr.set_source_rgb(0.1, 0.1, 0.1) + cr.arc(x, y, radius, 0, 2*math.pi) cr.fill() diff --git a/lib/xmet/spc.py b/lib/xmet/spc.py index 2a5228b..f20ef8a 100644 --- a/lib/xmet/spc.py +++ b/lib/xmet/spc.py @@ -925,4 +925,4 @@ class SPCOutlookMap(EquirectMap): if city is None: continue - self.draw_city(cr, city) + self.draw_city(cr, city, self.dark)