Theme · Platform: one platform for buttons and caps, icon themes, frosted panes

theme::Platform moves out of typography and shell's ControlsStyle folds
into it; the theme's platform starts as the system's. Window buttons Ely
draws, the title bar's layout and every key cap follow it, secondary
included, through typography::keys::keystroke; a title bar whose buttons
the OS draws follows the OS. primitives::IconTheme lays an owner's rules
by file name and extension over Ely's map, for every file icon.
shell::Vibrancy fills a pane with the palette's new glass, translucent
so a window opened Blurred shows its backdrop, solid under high contrast.
gpui 0.2.2 has no Mica; that line stays blocked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-09-27 17:41:15 -04:00
1 parent 53578e0525
commit f3c8cca4c9
30 files changed
+593 -162

No files matched your search

+4
View File
@@ -9,6 +9,7 @@ mod media;
mod messaging;
mod onboarding;
mod palette;
mod platform;
mod project;
mod syntax;
mod tokens;
@@ -32,6 +33,7 @@ pub use media::MediaSizes;
pub use messaging::MessagingSizes;
pub use onboarding::OnboardingSizes;
pub use palette::{HUE_NAMES, Mix, Palette, Syntax};
pub use platform::Platform;
pub use project::ProjectSizes;
pub use syntax::{SyntaxTheme, syntax_themes};
pub use tokens::{
@@ -69,6 +71,7 @@ pub struct Theme {
pub font_family: SharedString,
pub mono_family: SharedString,
pub reduced_motion: bool,
pub platform: Platform,
}
impl Global for Theme {}
@@ -97,6 +100,7 @@ impl Theme {
font_family: "Inter".into(),
mono_family: "JetBrains Mono".into(),
reduced_motion: false,
platform: Platform::current(),
});
}
+5
View File
@@ -116,6 +116,7 @@ mixable!(
backdrop,
media_backdrop,
shimmer,
glass,
shadow,
tooltip_bg,
tooltip_fg,
@@ -182,6 +183,7 @@ impl Palette {
backdrop: rgba(0x18161352).into(),
media_backdrop: rgba(0x0e0d0bf8).into(),
shimmer: rgba(0xffffffb3).into(),
glass: rgba(0xfcfaf7b8).into(),
shadow: c(0x181613),
tooltip_bg: c(0x181613),
tooltip_fg: c(0xfcfaf7),
@@ -215,6 +217,7 @@ impl Palette {
palette.fg_subtle = c(0x575552);
palette.border = c(0xa6a4a2);
palette.border_strong = c(0x82807d);
palette.glass = palette.bg;
}
palette
}
@@ -251,6 +254,7 @@ impl Palette {
backdrop: rgba(0x00000080).into(),
media_backdrop: rgba(0x000000f8).into(),
shimmer: rgba(0xffffff10).into(),
glass: rgba(0x131110b8).into(),
shadow: c(0x000000),
tooltip_bg: c(0x373533),
tooltip_fg: c(0xf3f1f0),
@@ -284,6 +288,7 @@ impl Palette {
palette.fg_subtle = c(0xafadab);
palette.border = c(0x6a6966);
palette.border_strong = c(0x858380);
palette.glass = palette.bg;
}
palette
}
+20
View File
@@ -0,0 +1,20 @@
/// Whose conventions the components follow: window buttons, the title bar's layout and key caps.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Platform {
Mac,
Windows,
Linux,
}
impl Platform {
/// The system this build targets, where the theme starts.
pub fn current() -> Self {
if cfg!(target_os = "macos") {
Platform::Mac
} else if cfg!(target_os = "windows") {
Platform::Windows
} else {
Platform::Linux
}
}
}
+16 -1
View File
@@ -26,7 +26,7 @@ fn every_color_answers_to_its_name() {
for (ix, name) in Palette::NAMES.iter().enumerate() {
*palette.token_mut(name) = hsla(ix as f32 / 64.0, 0.5, 0.5, 1.0);
}
assert_eq!(Palette::NAMES.len(), 35, "every color of the palette");
assert_eq!(Palette::NAMES.len(), 36, "every color of the palette");
let at = |name: &str| {
Palette::NAMES
.iter()
@@ -50,3 +50,18 @@ fn every_color_answers_to_its_name() {
fn an_unknown_color_fails() {
Palette::light(false).token_mut("glow");
}
#[test]
fn glass_lets_the_blur_through_until_high_contrast() {
for (plain, strong) in [
(Palette::light(false), Palette::light(true)),
(Palette::dark(false), Palette::dark(true)),
] {
assert!(
plain.glass.a > 0.0 && plain.glass.a < 1.0,
"{:?}",
plain.glass
);
assert_eq!(strong.glass, strong.bg);
}
}