ui: Fix swapped element background colors (#19701)
This PR fixes an issue introduced in https://github.com/zed-industries/zed/pull/18768 where the element backgrounds colors for `ElevationIndex::ElevatedSurface` and `ElevationIndex::Surface` were swapped. Release Notes: - N/A
This commit is contained in:
parent
454d3dd52b
commit
ca861bb1bb
1 changed files with 14 additions and 16 deletions
|
@ -149,8 +149,8 @@ pub(crate) struct ButtonLikeStyles {
|
||||||
fn element_bg_from_elevation(elevation: Option<ElevationIndex>, cx: &mut WindowContext) -> Hsla {
|
fn element_bg_from_elevation(elevation: Option<ElevationIndex>, cx: &mut WindowContext) -> Hsla {
|
||||||
match elevation {
|
match elevation {
|
||||||
Some(ElevationIndex::Background) => cx.theme().colors().element_background,
|
Some(ElevationIndex::Background) => cx.theme().colors().element_background,
|
||||||
Some(ElevationIndex::ElevatedSurface) => cx.theme().colors().surface_background,
|
Some(ElevationIndex::ElevatedSurface) => cx.theme().colors().elevated_surface_background,
|
||||||
Some(ElevationIndex::Surface) => cx.theme().colors().elevated_surface_background,
|
Some(ElevationIndex::Surface) => cx.theme().colors().surface_background,
|
||||||
Some(ElevationIndex::ModalSurface) => cx.theme().colors().background,
|
Some(ElevationIndex::ModalSurface) => cx.theme().colors().background,
|
||||||
_ => cx.theme().colors().element_background,
|
_ => cx.theme().colors().element_background,
|
||||||
}
|
}
|
||||||
|
@ -162,11 +162,9 @@ impl ButtonStyle {
|
||||||
elevation: Option<ElevationIndex>,
|
elevation: Option<ElevationIndex>,
|
||||||
cx: &mut WindowContext,
|
cx: &mut WindowContext,
|
||||||
) -> ButtonLikeStyles {
|
) -> ButtonLikeStyles {
|
||||||
let filled_background = element_bg_from_elevation(elevation, cx);
|
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
ButtonStyle::Filled => ButtonLikeStyles {
|
ButtonStyle::Filled => ButtonLikeStyles {
|
||||||
background: filled_background,
|
background: element_bg_from_elevation(elevation, cx),
|
||||||
border_color: transparent_black(),
|
border_color: transparent_black(),
|
||||||
label_color: Color::Default.color(cx),
|
label_color: Color::Default.color(cx),
|
||||||
icon_color: Color::Default.color(cx),
|
icon_color: Color::Default.color(cx),
|
||||||
|
@ -192,16 +190,18 @@ impl ButtonStyle {
|
||||||
elevation: Option<ElevationIndex>,
|
elevation: Option<ElevationIndex>,
|
||||||
cx: &mut WindowContext,
|
cx: &mut WindowContext,
|
||||||
) -> ButtonLikeStyles {
|
) -> ButtonLikeStyles {
|
||||||
let mut filled_background = element_bg_from_elevation(elevation, cx);
|
|
||||||
filled_background.fade_out(0.92);
|
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
ButtonStyle::Filled => ButtonLikeStyles {
|
ButtonStyle::Filled => {
|
||||||
background: filled_background,
|
let mut filled_background = element_bg_from_elevation(elevation, cx);
|
||||||
border_color: transparent_black(),
|
filled_background.fade_out(0.92);
|
||||||
label_color: Color::Default.color(cx),
|
|
||||||
icon_color: Color::Default.color(cx),
|
ButtonLikeStyles {
|
||||||
},
|
background: filled_background,
|
||||||
|
border_color: transparent_black(),
|
||||||
|
label_color: Color::Default.color(cx),
|
||||||
|
icon_color: Color::Default.color(cx),
|
||||||
|
}
|
||||||
|
}
|
||||||
ButtonStyle::Tinted(tint) => tint.button_like_style(cx),
|
ButtonStyle::Tinted(tint) => tint.button_like_style(cx),
|
||||||
ButtonStyle::Subtle => ButtonLikeStyles {
|
ButtonStyle::Subtle => ButtonLikeStyles {
|
||||||
background: cx.theme().colors().ghost_element_hover,
|
background: cx.theme().colors().ghost_element_hover,
|
||||||
|
@ -277,8 +277,6 @@ impl ButtonStyle {
|
||||||
elevation: Option<ElevationIndex>,
|
elevation: Option<ElevationIndex>,
|
||||||
cx: &mut WindowContext,
|
cx: &mut WindowContext,
|
||||||
) -> ButtonLikeStyles {
|
) -> ButtonLikeStyles {
|
||||||
element_bg_from_elevation(elevation, cx).fade_out(0.82);
|
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
ButtonStyle::Filled => ButtonLikeStyles {
|
ButtonStyle::Filled => ButtonLikeStyles {
|
||||||
background: cx.theme().colors().element_disabled,
|
background: cx.theme().colors().element_disabled,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue