Try to make light themes a bit more colorful

This commit is contained in:
Héctor Ramón Jiménez 2025-08-05 22:04:35 +02:00
parent e14d3609ac
commit 4d4f565da7
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
8 changed files with 18 additions and 15 deletions

View file

@ -623,7 +623,10 @@ fn darken(color: Color, amount: f32) -> Color {
let mut oklch = to_oklch(color);
// We try to bump the chroma a bit for more colorful palettes
oklch.c *= 1.0 + 2.0 * amount / oklch.l.max(0.05);
if oklch.c > 0.0 {
// Formula empirically and cluelessly derived
oklch.c *= 1.0 + (0.3 / oklch.c).min(100.0) * amount;
}
oklch.l = if oklch.l - amount < 0.0 {
0.0
@ -638,6 +641,7 @@ fn lighten(color: Color, amount: f32) -> Color {
let mut oklch = to_oklch(color);
// We try to bump the chroma a bit for more colorful palettes
// Formula empirically and cluelessly derived
oklch.c *= 1.0 + 2.0 * amount / oklch.l.max(0.05);
oklch.l = if oklch.l + amount > 1.0 {