Match exclusion accent in light mode
Use the stats highlight colour for exclusion outlines in light theme, keeping the gold highlight for dark mode.
This commit is contained in:
parent
f9e2dd84c3
commit
4fc0182798
|
|
@ -262,16 +262,19 @@ class ImageProcessingMixin:
|
||||||
draw.point((x, y), fill=(255, 0, 0, alpha))
|
draw.point((x, y), fill=(255, 0, 0, alpha))
|
||||||
merged = Image.alpha_composite(base, overlay)
|
merged = Image.alpha_composite(base, overlay)
|
||||||
outline = ImageDraw.Draw(merged)
|
outline = ImageDraw.Draw(merged)
|
||||||
|
accent_dark = (255, 215, 0, 200)
|
||||||
|
accent_light = (197, 98, 23, 200)
|
||||||
|
accent = accent_dark if getattr(self, "theme", "light") == "dark" else accent_light
|
||||||
for shape in getattr(self, "exclude_shapes", []):
|
for shape in getattr(self, "exclude_shapes", []):
|
||||||
if shape.get("kind") == "rect":
|
if shape.get("kind") == "rect":
|
||||||
x0, y0, x1, y1 = shape["coords"] # type: ignore[index]
|
x0, y0, x1, y1 = shape["coords"] # type: ignore[index]
|
||||||
outline.rectangle([x0, y0, x1, y1], outline=(255, 215, 0, 200), width=3)
|
outline.rectangle([x0, y0, x1, y1], outline=accent, width=3)
|
||||||
elif shape.get("kind") == "polygon":
|
elif shape.get("kind") == "polygon":
|
||||||
points = shape.get("points", [])
|
points = shape.get("points", [])
|
||||||
if len(points) < 2:
|
if len(points) < 2:
|
||||||
continue
|
continue
|
||||||
path = points if points[0] == points[-1] else points + [points[0]]
|
path = points if points[0] == points[-1] else points + [points[0]]
|
||||||
outline.line(path, fill=(255, 215, 0, 200), width=2, joint="round")
|
outline.line(path, fill=accent, width=2, joint="round")
|
||||||
return merged
|
return merged
|
||||||
|
|
||||||
def compute_stats_preview(self):
|
def compute_stats_preview(self):
|
||||||
|
|
@ -439,12 +442,15 @@ class ImageProcessingMixin:
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
self._exclude_canvas_ids = []
|
self._exclude_canvas_ids = []
|
||||||
|
accent_dark = "#ffd700"
|
||||||
|
accent_light = "#c56217"
|
||||||
|
accent = accent_dark if getattr(self, "theme", "light") == "dark" else accent_light
|
||||||
for shape in getattr(self, "exclude_shapes", []):
|
for shape in getattr(self, "exclude_shapes", []):
|
||||||
kind = shape.get("kind")
|
kind = shape.get("kind")
|
||||||
if kind == "rect":
|
if kind == "rect":
|
||||||
x0, y0, x1, y1 = shape["coords"] # type: ignore[index]
|
x0, y0, x1, y1 = shape["coords"] # type: ignore[index]
|
||||||
item = self.canvas_orig.create_rectangle(
|
item = self.canvas_orig.create_rectangle(
|
||||||
x0, y0, x1, y1, outline="yellow", width=3
|
x0, y0, x1, y1, outline=accent, width=3
|
||||||
)
|
)
|
||||||
self._exclude_canvas_ids.append(item)
|
self._exclude_canvas_ids.append(item)
|
||||||
elif kind == "polygon":
|
elif kind == "polygon":
|
||||||
|
|
@ -455,7 +461,7 @@ class ImageProcessingMixin:
|
||||||
coords = [coord for point in closed for coord in point] # type: ignore[misc]
|
coords = [coord for point in closed for coord in point] # type: ignore[misc]
|
||||||
item = self.canvas_orig.create_line(
|
item = self.canvas_orig.create_line(
|
||||||
*coords,
|
*coords,
|
||||||
fill="yellow",
|
fill=accent,
|
||||||
width=2,
|
width=2,
|
||||||
smooth=True,
|
smooth=True,
|
||||||
capstyle="round",
|
capstyle="round",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue