feat: add native material backgrounds

This commit is contained in:
2026-11-09 09:52:29 +07:00
parent 8c438ed8a6
commit 7784e8d570
14 changed files with 279 additions and 36 deletions
+8 -2
View File
@@ -14,13 +14,13 @@ mod resolve;
mod source;
mod system;
pub use colors::ColorTokens;
pub use colors::{ColorTokens, MaterialTokens};
pub use definition::ThemeDefinition;
pub use ramps::{AccentShades, Oklch};
pub use resolve::{Ramps, ResolvedTheme};
pub use system::{AccessibilityPreferences, PartialPalette, SourceKind, SystemTheme};
use gpui::{App, Global, Hsla, Pixels, WindowAppearance, px};
use gpui::{App, Global, Hsla, Pixels, WindowAppearance, WindowBackgroundAppearance, px};
use std::time::Duration;
/// The hairline width of the control border every button and field paints;
@@ -50,6 +50,8 @@ impl ThemeVariant {
pub struct Theme {
pub variant: ThemeVariant,
pub colors: ColorTokens,
/// The translucent paints over the window's native material.
pub material: MaterialTokens,
pub ramps: Ramps,
pub radius: Radius,
/// Per-platform border and focus chrome.
@@ -68,6 +70,8 @@ pub struct Theme {
pub mono_font: &'static str,
pub sizes: SizeTable,
pub accessibility: AccessibilityPreferences,
/// The material a window should open with, after accessibility.
pub window_background: WindowBackgroundAppearance,
}
impl Global for Theme {}
@@ -524,6 +528,7 @@ impl Theme {
Self {
variant: resolved.variant,
colors: resolved.colors,
material: resolved.material,
ramps: resolved.ramps,
radius: resolved.radius,
borders: resolved.borders,
@@ -536,6 +541,7 @@ impl Theme {
mono_font: resolved.mono_font,
sizes: resolved.sizes,
accessibility: resolved.accessibility,
window_background: resolved.window_background,
}
}