diff --git a/src/gui/theme/mod.rs b/src/gui/theme/mod.rs index a4408eb..4e5eaa7 100644 --- a/src/gui/theme/mod.rs +++ b/src/gui/theme/mod.rs @@ -15,6 +15,7 @@ pub type Element<'msg, Message> = iced::Element<'msg, Message, Renderer>; #[derive(Clone)] pub struct Theme { colors: Colors, + is_light: bool, } impl Default for Theme { @@ -29,6 +30,7 @@ impl Default for Theme { secondary: Shades::new(pigment.secondary), text: Shades::new(pigment.text), }, + is_light: shades::is_light(pigment.background), } } } @@ -216,7 +218,7 @@ impl text_input::StyleSheet for Theme { fn placeholder_color(&self, style: &Self::Style) -> iced::Color { match style { - TextInput::Primary => self.colors.text.light, //TODO lightest + TextInput::Primary => if self.is_light {self.colors.text.lightest} else {self.colors.text.darkest} } } diff --git a/src/gui/theme/pigment.rs b/src/gui/theme/pigment.rs index 4de7de4..da1d5a3 100644 --- a/src/gui/theme/pigment.rs +++ b/src/gui/theme/pigment.rs @@ -14,18 +14,18 @@ impl Default for Pigment { fn default() -> Pigment { Pigment { //day theme - accent: hex_to_color("#f8073b").unwrap(), - background: hex_to_color("#fafafa").unwrap(), - primary: hex_to_color("#f9682f").unwrap(), - secondary: hex_to_color("#fef2cd").unwrap(), - text: hex_to_color("#050505").unwrap(), + // accent: hex_to_color("#f8073b").unwrap(), + // background: hex_to_color("#fafafa").unwrap(), + // primary: hex_to_color("#f9682f").unwrap(), + // secondary: hex_to_color("#fef2cd").unwrap(), + // text: hex_to_color("#050505").unwrap(), //night theme - // accent: hex_to_color("#928fd6").unwrap(), - // background: hex_to_color("#050505").unwrap(), - // primary: hex_to_color("#2a4b74").unwrap(), - // secondary: hex_to_color("#0e0e25").unwrap(), - // text: hex_to_color("#fafafa").unwrap(), + accent: hex_to_color("#928fd6").unwrap(), + background: hex_to_color("#050505").unwrap(), + primary: hex_to_color("#2a4b74").unwrap(), + secondary: hex_to_color("#0e0e25").unwrap(), + text: hex_to_color("#fafafa").unwrap(), } } } diff --git a/src/gui/theme/shades.rs b/src/gui/theme/shades.rs index a61908f..1cc513f 100644 --- a/src/gui/theme/shades.rs +++ b/src/gui/theme/shades.rs @@ -62,6 +62,6 @@ fn lighten(color: Color, amount: f32) -> Color { from_hsl(hsl) } -pub fn is_dark(color: Color) -> bool { - to_hsl(color).lightness < 0.5 +pub fn is_light(color: Color) -> bool { + to_hsl(color).lightness > 0.5 }