color bugfix + more work on theme generation function

This commit is contained in:
Jakob Pinterits
2024-11-18 22:51:18 +01:00
parent 89752eed4a
commit 05f2bf3ee3
2 changed files with 7 additions and 4 deletions

View File

@@ -508,7 +508,7 @@ class Color(SelfSerializing):
darken the color instead.
"""
# The amount may be negative. If that is the case, delegate to `darker`
if amount <= 0:
if amount < 0:
return self.darker(-amount)
# HSV has an explicit value for brightness, so convert to HSV and bump
@@ -550,7 +550,7 @@ class Color(SelfSerializing):
the color instead.
"""
# The value may be negative. If that is the case, delegate to `brighter`
if amount <= 0:
if amount < 0:
return self.brighter(-amount)
return Color._map_rgb(self, lambda x: max(x - amount, 0))

View File

@@ -809,7 +809,6 @@ def _create_new_theme(
"""
Experimental next-gen theme creation function.
"""
# Accent palette
if accent_color is None:
accent_color = rio.Color.from_rgb(red=0.3, green=0.55, blue=0.92)
@@ -898,7 +897,11 @@ def _create_new_theme(
# Keep the disabled palette subdued. It's not meant to be perfectly
# readable
disabled_color = rio.Color.from_grey(0.6)
disabled_color = _derive_color(
neutral_color.desaturated(0.8),
0.15,
bias_to_bright=-0.3,
)
disabled_palette = Palette(
background=disabled_color,