From 822a3cd04f9edeb887d85164b0b3e556c3fde6bb Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 26 May 2022 01:10:26 +0200 Subject: Let a `Theme` control the `text_color` of an application --- style/src/theme.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'style/src/theme.rs') diff --git a/style/src/theme.rs b/style/src/theme.rs index e3c0efc6..1ddf97c3 100644 --- a/style/src/theme.rs +++ b/style/src/theme.rs @@ -31,12 +31,14 @@ impl Theme { impl Default for Theme { fn default() -> Self { - Self::Light + Self::Dark } } pub trait Definition { fn background_color(&self) -> Color; + + fn text_color(&self) -> Color; } impl Definition for Theme { @@ -45,6 +47,12 @@ impl Definition for Theme { palette.background.base } + + fn text_color(&self) -> Color { + let palette = self.extended_palette(); + + palette.background.text + } } #[derive(Debug, Clone, Copy, PartialEq, Eq)] -- cgit