From 987c2e9e4a1c314f0b8288de6a4b9932ca633e56 Mon Sep 17 00:00:00 2001 From: lm Date: Fri, 17 Oct 2025 17:25:27 +0200 Subject: [PATCH] Use themed preview accents Apply the theme-specific accent colour to exclusion previews so new shapes match the final outline in both light and dark modes. --- app/gui/exclusions.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/gui/exclusions.py b/app/gui/exclusions.py index 30701d3..8176f8d 100644 --- a/app/gui/exclusions.py +++ b/app/gui/exclusions.py @@ -20,12 +20,13 @@ class ExclusionMixin: self.canvas_orig.delete(preview_id) except Exception: pass + accent = self._exclusion_preview_colour() self._stroke_preview_id = self.canvas_orig.create_line( x, y, x, y, - fill="yellow", + fill=accent, width=2, smooth=True, capstyle="round", @@ -39,7 +40,8 @@ class ExclusionMixin: self.canvas_orig.delete(self._rubber_id) except Exception: pass - self._rubber_id = self.canvas_orig.create_rectangle(x, y, x, y, outline="yellow", width=2) + accent = self._exclusion_preview_colour() + self._rubber_id = self.canvas_orig.create_rectangle(x, y, x, y, outline=accent, width=2) def _exclude_drag(self, event): mode = getattr(self, "exclude_mode", "rect") @@ -153,6 +155,7 @@ class ExclusionMixin: next_mode = "free" if current == "rect" else "rect" self.exclude_mode = next_mode self._current_stroke = None + accent = self._exclusion_preview_colour() if next_mode == "free": if self._rubber_id: try: @@ -168,6 +171,7 @@ class ExclusionMixin: except Exception: pass self._stroke_preview_id = None + self._rubber_id = None message_key = "status.free_draw_enabled" if next_mode == "free" else "status.free_draw_disabled" if hasattr(self, "status"): try: @@ -186,6 +190,10 @@ class ExclusionMixin: compressed.append(point) return compressed + def _exclusion_preview_colour(self) -> str: + is_dark = getattr(self, "theme", "light") == "dark" + return "#ffd700" if is_dark else "#c56217" + @staticmethod def _close_polygon(points: list[tuple[int, int]]) -> list[tuple[int, int]]: """Ensure the polygon is closed by repeating the start if necessary."""