diff options
-rw-r--r-- | core/src/theme/palette.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/src/theme/palette.rs b/core/src/theme/palette.rs index ca91c248..91543567 100644 --- a/core/src/theme/palette.rs +++ b/core/src/theme/palette.rs @@ -612,11 +612,19 @@ fn mix(a: Color, b: Color, factor: f32) -> Color { fn readable(background: Color, text: Color) -> Color { if is_readable(background, text) { - text - } else if is_dark(background) { + return text; + } + + let fallback = if is_dark(background) { Color::WHITE } else { Color::BLACK + }; + + if is_readable(background, fallback) { + fallback + } else { + fallback.inverse() } } |