appearance.rs

 1use crate::prelude::*;
 2use gpui::{WindowBackgroundAppearance, WindowContext};
 3use theme::Appearance;
 4
 5/// Returns the current [Appearance].
 6pub fn appearance(cx: &WindowContext) -> Appearance {
 7    cx.theme().appearance
 8}
 9
10/// Returns the [WindowBackgroundAppearance].
11pub fn window_appearance(cx: &WindowContext) -> WindowBackgroundAppearance {
12    cx.theme().styles.window_background_appearance
13}
14
15/// Returns if the window and it's surfaces are expected
16/// to be transparent.
17///
18/// Helps determine if you need to take extra steps to prevent
19/// transparent backgrounds.
20pub fn window_is_transparent(cx: &WindowContext) -> bool {
21    match window_appearance(cx) {
22        WindowBackgroundAppearance::Transparent => true,
23        WindowBackgroundAppearance::Blurred => true,
24        _ => false,
25    }
26}