Skip to content

Commit

Permalink
add border widths to toggler stylesheet
Browse files Browse the repository at this point in the history
  • Loading branch information
GyulyVGC committed Jan 27, 2024
1 parent 5540ac0 commit b38deb8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
6 changes: 4 additions & 2 deletions style/src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,13 +721,15 @@ impl toggler::StyleSheet for Theme {
} else {
palette.background.strong.color
},
background_border: None,
background_border_width: 0.0,
background_border_color: Color::TRANSPARENT,
foreground: if is_active {
palette.primary.strong.text
} else {
palette.background.base.color
},
foreground_border: None,
foreground_border_width: 0.0,
foreground_border_color: Color::TRANSPARENT,
}
}
Toggler::Custom(custom) => custom.active(self, is_active),
Expand Down
8 changes: 6 additions & 2 deletions style/src/toggler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ use iced_core::Color;
pub struct Appearance {
/// The background [`Color`] of the toggler.
pub background: Color,
/// The width of the background border of the toggler.
pub background_border_width: f32,
/// The [`Color`] of the background border of the toggler.
pub background_border: Option<Color>,
pub background_border_color: Color,
/// The foreground [`Color`] of the toggler.
pub foreground: Color,
/// The width of the foreground border of the toggler.
pub foreground_border_width: f32,
/// The [`Color`] of the foreground border of the toggler.
pub foreground_border: Option<Color>,
pub foreground_border_color: Color,
}

/// A set of rules that dictate the style of a toggler.
Expand Down
8 changes: 4 additions & 4 deletions widget/src/toggler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ where
bounds: toggler_background_bounds,
border: Border {
radius: border_radius.into(),
width: 1.0,
color: style.background_border.unwrap_or(style.background),
width: style.background_border_width,
color: style.background_border_color,
},
..renderer::Quad::default()
},
Expand All @@ -340,8 +340,8 @@ where
bounds: toggler_foreground_bounds,
border: Border {
radius: border_radius.into(),
width: 1.0,
color: style.foreground_border.unwrap_or(style.foreground),
width: style.foreground_border_width,
color: style.foreground_border_color,
},
..renderer::Quad::default()
},
Expand Down

0 comments on commit b38deb8

Please sign in to comment.