diff options
Diffstat (limited to 'style/src/theme.rs')
-rw-r--r-- | style/src/theme.rs | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs index 27d5b5e0..78995e23 100644 --- a/style/src/theme.rs +++ b/style/src/theme.rs @@ -8,7 +8,6 @@ use crate::core::widget::text; use crate::menu; use crate::pane_grid; use crate::pick_list; -use crate::text_editor; use crate::core::{Background, Border, Color}; @@ -440,123 +439,3 @@ impl pane_grid::StyleSheet for Theme { } impl text::StyleSheet for Theme {} - -/// The style of a text input. -#[derive(Default)] -pub enum TextEditor { - /// The default style. - #[default] - Default, - /// A custom style. - Custom(Box<dyn text_editor::StyleSheet<Style = Theme>>), -} - -impl text_editor::StyleSheet for Theme { - type Style = TextEditor; - - fn active(&self, style: &Self::Style) -> text_editor::Appearance { - if let TextEditor::Custom(custom) = style { - return custom.active(self); - } - - let palette = self.extended_palette(); - - text_editor::Appearance { - background: palette.background.base.color.into(), - border: Border { - radius: 2.0.into(), - width: 1.0, - color: palette.background.strong.color, - }, - } - } - - fn hovered(&self, style: &Self::Style) -> text_editor::Appearance { - if let TextEditor::Custom(custom) = style { - return custom.hovered(self); - } - - let palette = self.extended_palette(); - - text_editor::Appearance { - background: palette.background.base.color.into(), - border: Border { - radius: 2.0.into(), - width: 1.0, - color: palette.background.base.text, - }, - } - } - - fn focused(&self, style: &Self::Style) -> text_editor::Appearance { - if let TextEditor::Custom(custom) = style { - return custom.focused(self); - } - - let palette = self.extended_palette(); - - text_editor::Appearance { - background: palette.background.base.color.into(), - border: Border { - radius: 2.0.into(), - width: 1.0, - color: palette.primary.strong.color, - }, - } - } - - fn placeholder_color(&self, style: &Self::Style) -> Color { - if let TextEditor::Custom(custom) = style { - return custom.placeholder_color(self); - } - - let palette = self.extended_palette(); - - palette.background.strong.color - } - - fn value_color(&self, style: &Self::Style) -> Color { - if let TextEditor::Custom(custom) = style { - return custom.value_color(self); - } - - let palette = self.extended_palette(); - - palette.background.base.text - } - - fn selection_color(&self, style: &Self::Style) -> Color { - if let TextEditor::Custom(custom) = style { - return custom.selection_color(self); - } - - let palette = self.extended_palette(); - - palette.primary.weak.color - } - - fn disabled(&self, style: &Self::Style) -> text_editor::Appearance { - if let TextEditor::Custom(custom) = style { - return custom.disabled(self); - } - - let palette = self.extended_palette(); - - text_editor::Appearance { - background: palette.background.weak.color.into(), - border: Border { - radius: 2.0.into(), - width: 1.0, - color: palette.background.strong.color, - }, - } - } - - fn disabled_color(&self, style: &Self::Style) -> Color { - if let TextEditor::Custom(custom) = style { - return custom.disabled_color(self); - } - - self.placeholder_color(style) - } -} |