use iced::Background; use iced::Color; use iced::widget::container; use iced::widget::text_input; const TRANSPARENT: Color = Color { r: 0., g: 0., b: 0., a: 0. }; #[derive(Copy, Clone, Debug)] pub struct Theme { pub base_color: Color, pub text_color: Color, } impl Default for Theme { fn default() -> Self { Theme { base_color: Color {r: 236. / 255., g: 63. / 255., b: 53. / 255., a: 1.}, text_color: Color {r: 1., g: 1., b: 1., a: 1.}, } } } impl container::StyleSheet for Theme { fn style(&self) -> container::Style { container::Style { text_color: Some(self.text_color), background: Some(Background::Color(self.base_color)), ..Default::default() } } } impl text_input::StyleSheet for Theme { fn active(&self) -> text_input::Style { text_input::Style { background: Background::Color(self.base_color), border_radius: 0., border_width: 0., ..Default::default() } } fn focused(&self) -> text_input::Style { self.active() } fn placeholder_color(&self) -> Color { let mut color = self.text_color; color.a = 0.5; color } fn value_color(&self) -> Color { self.text_color } fn selection_color(&self) -> Color { self.text_color } }