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)   --- #### Before | After (Solid status background color – No change)   Release Notes: - Improved support for transparent status colors in themes.
27 lines
807 B
Rust
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,
|
|
}
|
|
}
|