From 68becf32c2e09f8c426ff8d40ec7e814d446b17a Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Mon, 22 Apr 2024 20:04:46 +0200 Subject: [PATCH] fix(theme): light theme surface lightness is inverted In Figma, themes with background lightness above 88 have their surfaces darkened; whereas below 88 have their surfaces lightened. This fixes custom light theme surfaces being unusually dark against a darker background. --- cosmic-theme/src/steps.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cosmic-theme/src/steps.rs b/cosmic-theme/src/steps.rs index 6487ba85..c129ea7c 100644 --- a/cosmic-theme/src/steps.rs +++ b/cosmic-theme/src/steps.rs @@ -40,9 +40,9 @@ pub fn get_surface_color( fallback: &Srgba, ) -> Srgba { assert!(step_array.len() == 100); - if !is_dark && base_index >= 88 { - is_dark = true; - } + + is_dark = !is_dark && base_index < 88; + get_index(base_index, steps, step_array.len(), is_dark) .and_then(|i| step_array.get(i).cloned()) .unwrap_or_else(|| fallback.to_owned())