add brand theme

This commit is contained in:
2026-08-20 17:52:02 +07:00
parent 584a8385a1
commit 8be65b7904
9 changed files with 746 additions and 83 deletions
+29 -1
View File
@@ -3,7 +3,7 @@ use std::sync::Arc;
use assets::Assets;
use dock::TAB_BAR_HEIGHT;
use gpui::*;
use gpui_component::theme;
use gpui_component::{Theme, ThemeRegistry, theme};
use gpui_platform::application;
fn main() {
@@ -27,6 +27,34 @@ fn main() {
// Initialize theme
theme::init(cx);
// Register the built-in "Signed" theme (light + dark variants)
// and make it the active theme, following the system appearance.
let registry = ThemeRegistry::global_mut(cx);
for (name, content) in Assets.themes() {
if let Err(err) = registry.load_themes_from_str(&content) {
tracing::error!("Failed to load theme {name}: {err}");
}
}
let light_theme = registry.themes().get("Signed Light").cloned();
let dark_theme = registry.themes().get("Signed Dark").cloned();
let theme = Theme::global_mut(cx);
theme.radius = px(2.);
theme.radius_lg = px(6.);
theme.focus_ring = false;
theme.shadow = false;
if let Some(light) = light_theme {
theme.light_theme = light;
}
if let Some(dark) = dark_theme {
theme.dark_theme = dark;
}
// Sync the theme with the system appearance
Theme::sync_system_appearance(None, cx);
// Install the shared image cache so avatars can be freed when
// their views close, instead of staying in memory forever.
workspace::image_cache::init(cx);