fix: restore default colour swatch on slider reset

Call the default colour helper during slider reset so the swatch and hex label jump back to the configured initial colour.
This commit is contained in:
lm 2025-10-17 16:46:58 +02:00
parent 91fad62808
commit 5cb2945577
1 changed files with 14 additions and 0 deletions

View File

@ -12,6 +12,20 @@ class ResetMixin:
self.val_max.set(self.DEFAULTS["val_max"])
self.alpha.set(self.DEFAULTS["alpha"])
self.update_preview()
try:
default_hex = self._default_colour_hex() # type: ignore[attr-defined]
except Exception:
default_hex = None
if default_hex and hasattr(self, "_parse_hex_colour") and hasattr(self, "_update_selected_colour"):
try:
rgb = self._parse_hex_colour(default_hex) # type: ignore[attr-defined]
except Exception:
rgb = None
if rgb:
try:
self._update_selected_colour(*rgb) # type: ignore[arg-type,attr-defined]
except Exception:
pass
default_text = getattr(self, "status_default_text", None)
if default_text is None:
default_text = self._t("status.defaults_restored") if hasattr(self, "_t") else "Defaults restored."