fix: scrollbar colors
This commit is contained in:
parent
8157ed5c63
commit
95bf466607
1 changed files with 43 additions and 20 deletions
|
|
@ -838,51 +838,74 @@ impl rule::StyleSheet for Theme {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default, Clone, Copy)]
|
||||||
|
pub enum Scrollable {
|
||||||
|
#[default]
|
||||||
|
Permanent,
|
||||||
|
Minimal,
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: Scrollable
|
* TODO: Scrollable
|
||||||
*/
|
*/
|
||||||
impl scrollable::StyleSheet for Theme {
|
impl scrollable::StyleSheet for Theme {
|
||||||
type Style = ();
|
type Style = Scrollable;
|
||||||
|
|
||||||
fn active(&self, _style: &Self::Style) -> scrollable::Scrollbar {
|
fn active(&self, style: &Self::Style) -> scrollable::Scrollbar {
|
||||||
let cosmic = self.cosmic();
|
let cosmic = self.cosmic();
|
||||||
scrollable::Scrollbar {
|
let mut neutral_5 = cosmic.palette.neutral_5;
|
||||||
background: Some(Background::Color(
|
neutral_5.alpha = 0.7;
|
||||||
self.current_container().component.base.into(),
|
let mut a = scrollable::Scrollbar {
|
||||||
)),
|
background: None,
|
||||||
border_radius: cosmic.corner_radii.radius_s.into(),
|
border_radius: cosmic.corner_radii.radius_s.into(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
scroller: scrollable::Scroller {
|
scroller: scrollable::Scroller {
|
||||||
color: self.current_container().component.divider.into(),
|
color: neutral_5.into(),
|
||||||
border_radius: cosmic.corner_radii.radius_s.into(),
|
border_radius: cosmic.corner_radii.radius_s.into(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
},
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
if matches!(style, Scrollable::Permanent) {
|
||||||
|
let mut neutral_3 = cosmic.palette.neutral_3;
|
||||||
|
neutral_3.alpha = 0.7;
|
||||||
|
a.background = Some(Background::Color(neutral_3.into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hovered(
|
fn hovered(&self, style: &Self::Style, is_mouse_over_scrollbar: bool) -> scrollable::Scrollbar {
|
||||||
&self,
|
let cosmic = self.cosmic();
|
||||||
_style: &Self::Style,
|
let mut neutral_5 = cosmic.palette.neutral_5;
|
||||||
_is_mouse_over_scrollbar: bool,
|
neutral_5.alpha = 0.7;
|
||||||
) -> scrollable::Scrollbar {
|
|
||||||
let theme = self.cosmic();
|
|
||||||
|
|
||||||
scrollable::Scrollbar {
|
if is_mouse_over_scrollbar {
|
||||||
background: Some(Background::Color(
|
let mut hover_overlay = cosmic.palette.neutral_0;
|
||||||
self.current_container().component.hover.into(),
|
hover_overlay.alpha = 0.2;
|
||||||
)),
|
neutral_5 = over(hover_overlay, neutral_5);
|
||||||
border_radius: theme.corner_radii.radius_s.into(),
|
}
|
||||||
|
let mut a = scrollable::Scrollbar {
|
||||||
|
background: None,
|
||||||
|
border_radius: cosmic.corner_radii.radius_s.into(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
scroller: scrollable::Scroller {
|
scroller: scrollable::Scroller {
|
||||||
color: theme.accent.base.into(),
|
color: neutral_5.into(),
|
||||||
border_radius: theme.corner_radii.radius_s.into(),
|
border_radius: cosmic.corner_radii.radius_s.into(),
|
||||||
border_width: 0.0,
|
border_width: 0.0,
|
||||||
border_color: Color::TRANSPARENT,
|
border_color: Color::TRANSPARENT,
|
||||||
},
|
},
|
||||||
|
};
|
||||||
|
if matches!(style, Scrollable::Permanent) {
|
||||||
|
let mut neutral_3 = cosmic.palette.neutral_3;
|
||||||
|
neutral_3.alpha = 0.7;
|
||||||
|
a.background = Some(Background::Color(neutral_3.into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue