Files
zed/crates/ui/src/styles/appearance.rs
Nate Butler b691d1baf2 Improve experience when themes provide transparent status colors (#13996)
We shouldn't assume all themes will give us solid status color
backgrounds.

This change makes it so the status color renders on top of a normal
elevated surface background.

#### Before | After (Transparent status background color – Fixed)

![CleanShot 2024-07-09 at 10 50
17@2x](https://github.com/zed-industries/zed/assets/1714999/5f4b24c1-335a-4ed8-a1d0-f511e217e4a5)

![CleanShot 2024-07-09 at 10 50
31@2x](https://github.com/zed-industries/zed/assets/1714999/38c06533-bda5-4cfb-822a-ed5a9639fc33)

---

#### Before | After (Solid status background color – No change)

![CleanShot 2024-07-09 at 10 49
43@2x](https://github.com/zed-industries/zed/assets/1714999/bd60c807-a7bb-4f60-ab47-ddba17288e93)

![CleanShot 2024-07-09 at 10 49
58@2x](https://github.com/zed-industries/zed/assets/1714999/6ab27d60-5a77-448c-a23b-569b337f11e1)



Release Notes:

- Improved support for transparent status colors in themes.
2024-07-09 11:27:47 -04:00

27 lines
807 B
Rust

use crate::prelude::*;
use gpui::{WindowBackgroundAppearance, WindowContext};
use theme::Appearance;
/// Returns the current [Appearance].
pub fn appearance(cx: &WindowContext) -> Appearance {
cx.theme().appearance
}
/// Returns the [WindowBackgroundAppearance].
pub fn window_appearance(cx: &WindowContext) -> WindowBackgroundAppearance {
cx.theme().styles.window_background_appearance
}
/// Returns if the window and it's surfaces are expected
/// to be transparent.
///
/// Helps determine if you need to take extra steps to prevent
/// transparent backgrounds.
pub fn window_is_transparent(cx: &WindowContext) -> bool {
match window_appearance(cx) {
WindowBackgroundAppearance::Transparent => true,
WindowBackgroundAppearance::Blurred => true,
_ => false,
}
}