fix: match the button overlays with figma, and if the button is transparent, use the overlay directly for hover and pressed states

This commit is contained in:
Ashley Wulber 2023-10-26 11:55:07 -04:00 committed by Ashley Wulber
parent 7b2b8952c6
commit 18b22905e2
2 changed files with 19 additions and 21 deletions

View file

@ -189,9 +189,21 @@ where
Component {
base: base.clone().into(),
hover: over(hovered.clone(), base).into(),
pressed: over(pressed, base).into(),
selected: over(hovered, base).into(),
hover: if base.alpha < 0.001 {
hovered.clone()
} else {
over(hovered.clone(), base).into()
},
pressed: if base.alpha < 0.001 {
pressed.clone()
} else {
over(pressed.clone(), base).into()
},
selected: if base.alpha < 0.001 {
hovered.clone()
} else {
over(hovered.clone(), base).into()
},
selected_text: accent.clone(),
focus: accent.clone(),
divider: if is_high_contrast {

View file

@ -856,24 +856,10 @@ impl ThemeBuilder {
color
};
let (button_hovered_hue, button_pressed_hye) = if is_dark {
(46.0, 22.0)
} else {
(158.0, 190.0)
};
let button_hovered_overlay = Srgba::new(
button_hovered_hue / 255.0,
button_hovered_hue / 255.0,
button_hovered_hue / 255.0,
0.5,
);
let button_pressed_overlay = Srgba::new(
button_pressed_hye / 255.0,
button_pressed_hye / 255.0,
button_pressed_hye / 255.0,
0.5,
);
let (mut button_hovered_overlay, mut button_pressed_overlay) =
(p_ref.neutral_5, p_ref.neutral_2);
button_hovered_overlay.alpha = 0.2;
button_pressed_overlay.alpha = 0.5;
let mut theme: Theme<Srgba> = Theme {
name: palette.name().to_string(),