theme: Add color darken
function (#20746)
This PR adds a `darken` function that allows to reduce the lightness of a color by a certain factor. This popped up as I wanted to add hover styles to tinted-colors buttons. Release Notes: - N/A
This commit is contained in:
parent
3f905d57e5
commit
0e7770a9a2
2 changed files with 22 additions and 1 deletions
|
@ -202,7 +202,12 @@ impl ButtonStyle {
|
|||
icon_color: Color::Default.color(cx),
|
||||
}
|
||||
}
|
||||
ButtonStyle::Tinted(tint) => tint.button_like_style(cx),
|
||||
ButtonStyle::Tinted(tint) => {
|
||||
let mut styles = tint.button_like_style(cx);
|
||||
let theme = cx.theme();
|
||||
styles.background = theme.darken(styles.background, 0.05, 0.2);
|
||||
styles
|
||||
}
|
||||
ButtonStyle::Subtle => ButtonLikeStyles {
|
||||
background: cx.theme().colors().ghost_element_hover,
|
||||
border_color: transparent_black(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue