pub mod appearance;
mod brand;
mod color;
mod paint;
mod platform;
mod theme;
pub use brand::{BASE_COLORS, Brand, Tint, Vibrancy, brand, set_brand};
pub use platform::{LENSED, frosted_window};
pub use color::{
contrast_ratio, flatten, grey, hsl_to_rgb, lightness, mix, neutral, oklch, oklch_to_srgb,
relative_luminance, rgb_to_hsl, tint,
};
pub use paint::{
INK_FILL_SCALE, INK_HAIRLINE_SCALE, SCRIM_ALPHA_DARK, band, card_selected_bg,
card_selected_shadows, current_appearance, glass_selected_bg, glass_selected_shadows, hairline,
ink, lock_appearance, scrim, set_current_appearance, surface_shadows, theme_generation,
user_bubble_bg, wash,
};
pub use theme::{
ControlSize, Glass, HighlightKind, Material, MaterialSpec, Metrics, Sizing, SurfaceSpec,
SurfaceStyle, SyntaxPalette, TextStyle, Theme, Typeset, base_text_size, set_base_text_size,
set_palette,
};
pub trait ThemeExt {
fn theme(&self) -> &Theme;
}
impl ThemeExt for Theme {
fn theme(&self) -> &Theme {
self
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub enum Appearance {
#[default]
Dark,
Light,
}
impl Appearance {
pub fn is_dark(self) -> bool {
matches!(self, Self::Dark)
}
pub fn is_light(self) -> bool {
matches!(self, Self::Light)
}
pub fn from_window(appearance: gpui::WindowAppearance) -> Self {
use gpui::WindowAppearance::*;
match appearance {
Light | VibrantLight => Self::Light,
Dark | VibrantDark => Self::Dark,
}
}
}