summaryrefslogtreecommitdiffstats
path: root/style/src/theme.rs
diff options
context:
space:
mode:
Diffstat (limited to 'style/src/theme.rs')
-rw-r--r--style/src/theme.rs35
1 files changed, 35 insertions, 0 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs
index b1e18c55..0bae671e 100644
--- a/style/src/theme.rs
+++ b/style/src/theme.rs
@@ -14,6 +14,7 @@ use crate::radio;
use crate::rule;
use crate::scrollable;
use crate::slider;
+use crate::text;
use crate::text_input;
use crate::toggler;
@@ -602,6 +603,40 @@ impl scrollable::StyleSheet for Theme {
}
/*
+ * Text
+ */
+#[derive(Clone, Copy)]
+pub enum Text {
+ Default,
+ Color(Color),
+ Custom(fn(&Theme) -> text::Appearance),
+}
+
+impl Default for Text {
+ fn default() -> Self {
+ Self::Default
+ }
+}
+
+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 => Default::default(),
+ Text::Color(c) => text::Appearance { color: Some(c) },
+ Text::Custom(f) => f(self),
+ }
+ }
+}
+
+/*
* Text Input
*/
impl text_input::StyleSheet for Theme {