aboutsummaryrefslogtreecommitdiff
path: root/src/toggler.rs
diff options
context:
space:
mode:
authorPolesznyák Márk <contact@pml68.dev>2025-11-21 11:28:07 +0100
committerPolesznyák Márk <contact@pml68.dev>2025-11-21 11:28:07 +0100
commit849cc869be51ccf79b603662fb7db13c241fbc9a (patch)
tree767e0a66a0728564ca559dbbf1afb264b92b4604 /src/toggler.rs
parentdocs(README): correct package name (diff)
downloadiced_material-849cc869be51ccf79b603662fb7db13c241fbc9a.tar.gz
chore: update as necessary for upstream iced changes
Diffstat (limited to '')
-rw-r--r--src/toggler.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/toggler.rs b/src/toggler.rs
index 5cebc88..cf2aa1d 100644
--- a/src/toggler.rs
+++ b/src/toggler.rs
@@ -21,6 +21,7 @@ impl Catalog for Theme {
pub fn styled(
background: Color,
foreground: Color,
+ text_color: Color,
border: Option<Color>,
) -> Style {
Style {
@@ -30,6 +31,7 @@ pub fn styled(
foreground,
foreground_border_width: 0.0,
foreground_border_color: Color::TRANSPARENT,
+ text_color: Some(text_color),
}
}
@@ -40,18 +42,29 @@ pub fn default(theme: &Theme, status: Status) -> Style {
match status {
Status::Active { is_toggled } => {
if is_toggled {
- styled(primary.color, primary.on_primary, None)
+ styled(
+ primary.color,
+ primary.on_primary,
+ surface.on_surface,
+ None,
+ )
} else {
styled(
surface.surface_container.highest,
theme.colors().outline.color,
+ surface.on_surface,
Some(theme.colors().outline.color),
)
}
}
Status::Hovered { is_toggled } => {
if is_toggled {
- styled(primary.color, primary.primary_container, None)
+ styled(
+ primary.color,
+ primary.primary_container,
+ surface.on_surface,
+ None,
+ )
} else {
styled(
mix(
@@ -60,6 +73,7 @@ pub fn default(theme: &Theme, status: Status) -> Style {
HOVERED_LAYER_OPACITY,
),
surface.on_surface_variant,
+ surface.on_surface,
Some(theme.colors().outline.color),
)
}
@@ -67,6 +81,7 @@ pub fn default(theme: &Theme, status: Status) -> Style {
Status::Disabled => styled(
disabled_container(surface.surface_container.highest),
disabled_text(surface.on_surface),
+ surface.on_surface,
Some(disabled_text(surface.on_surface)),
),
}