template-processor: general_normal_light, clamp lightness to give better results in light mode

This commit is contained in:
Lemmy
2026-02-08 10:35:52 -05:00
parent 61c1d52cfb
commit 007912faa9
+4 -3
View File
@@ -326,14 +326,15 @@ def generate_normal_light(palette: list[Color]) -> dict[str, str]:
error = find_error_color(palette)
# Keep colors vibrant - darken for visibility on light bg
# Clamp lightness to [0.25, 0.45] so colors are never near-black nor washed out
h, s, l = primary.to_hsl()
primary_adjusted = Color.from_hsl(h, max(s, 0.7), min(l, 0.45))
primary_adjusted = Color.from_hsl(h, max(s, 0.7), max(min(l, 0.45), 0.25))
h, s, l = secondary.to_hsl()
secondary_adjusted = Color.from_hsl(h, max(s, 0.6), min(l, 0.40))
secondary_adjusted = Color.from_hsl(h, max(s, 0.6), max(min(l, 0.40), 0.22))
h, s, l = tertiary.to_hsl()
tertiary_adjusted = Color.from_hsl(h, max(s, 0.5), min(l, 0.35))
tertiary_adjusted = Color.from_hsl(h, max(s, 0.5), max(min(l, 0.35), 0.20))
# Container colors - lighter, less saturated versions of accent colors for light mode
def make_container_light(base: Color) -> Color: