summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--style/src/theme.rs29
1 files changed, 22 insertions, 7 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs
index 713225e1..71a25dbe 100644
--- a/style/src/theme.rs
+++ b/style/src/theme.rs
@@ -284,17 +284,32 @@ impl pane_grid::StyleSheet for Theme {
/*
* Rule
*/
+#[derive(Clone, Copy)]
+pub enum Rule {
+ Default,
+ Custom(fn(&Theme) -> rule::Appearance),
+}
+
+impl Default for Rule {
+ fn default() -> Self {
+ Self::Default
+ }
+}
+
impl rule::StyleSheet for Theme {
- type Style = ();
+ type Style = Rule;
- fn style(&self, _style: Self::Style) -> rule::Appearance {
+ fn style(&self, style: Self::Style) -> rule::Appearance {
let palette = self.extended_palette();
- rule::Appearance {
- color: palette.background.strong.color,
- width: 1,
- radius: 0.0,
- fill_mode: rule::FillMode::Full,
+ match style {
+ Rule::Default => rule::Appearance {
+ color: palette.background.strong.color,
+ width: 1,
+ radius: 0.0,
+ fill_mode: rule::FillMode::Full,
+ },
+ Rule::Custom(f) => f(self),
}
}
}