simplify theme crate to builtin-only registry
This commit is contained in:
+4
-27
@@ -1,8 +1,8 @@
|
||||
use gpui::{App, Pixels, px};
|
||||
|
||||
pub mod builtins;
|
||||
mod builtins;
|
||||
mod geometry;
|
||||
pub mod model;
|
||||
mod model;
|
||||
mod notification;
|
||||
mod platform_kind;
|
||||
mod resolved;
|
||||
@@ -17,26 +17,15 @@ pub use resolved::{ResolvedAccentRoles, ResolvedColors};
|
||||
pub use runtime::Theme;
|
||||
pub use scrollbar_mode::*;
|
||||
|
||||
/// Defines window border radius for platforms that use client side decorations.
|
||||
pub const CLIENT_SIDE_DECORATION_ROUNDING: Pixels = px(10.0);
|
||||
|
||||
/// Defines window shadow size for platforms that use client side decorations.
|
||||
pub const CLIENT_SIDE_DECORATION_SHADOW: Pixels = px(10.0);
|
||||
|
||||
/// Defines window border size for platforms that use client side decorations.
|
||||
pub const CLIENT_SIDE_DECORATION_BORDER: Pixels = px(1.0);
|
||||
|
||||
/// Defines window titlebar height
|
||||
pub(crate) const TITLEBAR_HEIGHT: Pixels = px(36.0);
|
||||
|
||||
/// Defines workspace tabbar height
|
||||
pub const TABBAR_HEIGHT: Pixels = px(36.0);
|
||||
|
||||
/// Defines default sidebar width
|
||||
pub const SIDEBAR_WIDTH: Pixels = px(240.);
|
||||
|
||||
pub fn init(cx: &mut App) {
|
||||
for issue in ThemeRegistry::active().validate() {
|
||||
for issue in ThemeRegistry::builtin().validate() {
|
||||
log::warn!("theme {}: {}", issue.variant_id, issue.message);
|
||||
}
|
||||
|
||||
@@ -44,19 +33,7 @@ pub fn init(cx: &mut App) {
|
||||
Theme::sync_scrollbar_appearance(cx);
|
||||
}
|
||||
|
||||
/// Mirror the active coop theme into the `gpui-base` global theme.
|
||||
///
|
||||
/// Base paints a few things from its own tokens -- the focus ring, the wash
|
||||
/// behind selected text, scrollbars, and overlay backdrops -- so the two
|
||||
/// globals have to agree or those details drift away from the palette.
|
||||
///
|
||||
/// Only roles base can act on are projected. Radius, spacing, typography sizes,
|
||||
/// shadows, and scrollbar geometry keep their base defaults: coop has a single
|
||||
/// `radius`/`radius_lg`/`font_size` where base has six-point scales, so any
|
||||
/// mapping would be invented rather than derived.
|
||||
///
|
||||
/// This is a no-op before the coop theme global exists; [`Theme::change`] is the
|
||||
/// authoritative hook that keeps the projection current.
|
||||
/// Project the active theme onto the `gpui-base` global (focus ring, selection wash, scrollbars, backdrops).
|
||||
pub fn sync_base(cx: &mut App) {
|
||||
let Some(theme) = cx.try_global::<Theme>() else {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user