Skip to content

Commit

Permalink
improv(slider): add styling for breakpoint and right rail
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick committed Feb 21, 2024
1 parent 08b2e1c commit e90b584
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion iced
7 changes: 5 additions & 2 deletions src/theme/style/iced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,7 @@ impl slider::StyleSheet for Theme {
rail: Rail {
colors: slider::RailBackground::Pair(
cosmic.accent.base.into(),
//TODO: no way to set color before/after slider
Color::TRANSPARENT,
cosmic.palette.neutral_6.into(),
),
width: 4.0,
border_radius: cosmic.corner_radii.radius_xs.into(),
Expand All @@ -573,6 +572,10 @@ impl slider::StyleSheet for Theme {
border_color: Color::TRANSPARENT,
border_width: 0.0,
},

breakpoint: slider::Breakpoint {
color: cosmic.on_bg_color().into(),
},
}
}
Slider::Custom { active, .. } => active(self),
Expand Down
6 changes: 3 additions & 3 deletions src/widget/color_picker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ where
.style(Slider::Custom {
active: Rc::new(|t| {
let cosmic = t.cosmic();
let mut a = iced_style::slider::StyleSheet::active(t, &Slider::default());
let mut a = slider::StyleSheet::active(t, &Slider::default());
a.rail.colors = RailBackground::Gradient {
gradient: Linear::new(Radians(0.0)).add_stops(HSV_RAINBOW.clone()),
auto_angle: true,
Expand All @@ -317,7 +317,7 @@ where
}),
hovered: Rc::new(|t| {
let cosmic = t.cosmic();
let mut a = iced_style::slider::StyleSheet::active(t, &Slider::default());
let mut a = slider::StyleSheet::active(t, &Slider::default());
a.rail.colors = RailBackground::Gradient {
gradient: Linear::new(Radians(0.0)).add_stops(HSV_RAINBOW.clone()),
auto_angle: true,
Expand All @@ -331,7 +331,7 @@ where
}),
dragging: Rc::new(|t| {
let cosmic = t.cosmic();
let mut a = iced_style::slider::StyleSheet::active(t, &Slider::default());
let mut a = slider::StyleSheet::active(t, &Slider::default());
a.rail.colors = RailBackground::Gradient {
gradient: Linear::new(Radians(0.0)).add_stops(HSV_RAINBOW.clone()),
auto_angle: true,
Expand Down

0 comments on commit e90b584

Please sign in to comment.