Simplify theming for Text widget

This commit is contained in:
Héctor Ramón Jiménez 2024-03-04 19:31:26 +01:00
parent ce309db37b
commit 4130ae4be9
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
12 changed files with 116 additions and 122 deletions

View file

@ -1203,32 +1203,7 @@ impl scrollable::StyleSheet for Theme {
}
}
/// The style of text.
#[derive(Clone, Copy, Default)]
pub enum Text {
/// The default style.
#[default]
Default,
/// Colored text.
Color(Color),
}
impl From<Color> for Text {
fn from(color: Color) -> Self {
Text::Color(color)
}
}
impl text::StyleSheet for Theme {
type Style = Text;
fn appearance(&self, style: Self::Style) -> text::Appearance {
match style {
Text::Default => text::Appearance::default(),
Text::Color(c) => text::Appearance { color: Some(c) },
}
}
}
impl text::StyleSheet for Theme {}
/// The style of a text input.
#[derive(Default)]