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.
This commit is contained in:
Michael Aaron Murphy 2024-04-22 20:04:46 +02:00 committed by Michael Murphy
parent 9ffb87d21f
commit 68becf32c2

View file

@ -40,9 +40,9 @@ pub fn get_surface_color(
fallback: &Srgba, fallback: &Srgba,
) -> Srgba { ) -> Srgba {
assert!(step_array.len() == 100); 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) get_index(base_index, steps, step_array.len(), is_dark)
.and_then(|i| step_array.get(i).cloned()) .and_then(|i| step_array.get(i).cloned())
.unwrap_or_else(|| fallback.to_owned()) .unwrap_or_else(|| fallback.to_owned())