feat: unify theme system (#7)

Reviewed-on: #7
This commit was merged in pull request #7.
This commit is contained in:
2026-11-16 12:58:32 +00:00
parent 745a01d7af
commit aed3601c89
47 changed files with 888 additions and 1875 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ use std::sync::Arc;
use gpui::{
AnyElement, AnyView, App, Axis, Div, ElementId, Entity, IntoElement, ParentElement as _,
Render, RenderOnce, SharedString, StyleRefinement, Styled as _, Window, div, rems,
Render, RenderOnce, SharedString, StyleRefinement, Styled as _, Window, div,
};
use gpui_native_theme::ActiveTheme as _;
use gpui_native_utils::StyledExt as _;
@@ -126,7 +126,7 @@ impl gpui::Styled for PanelRow {
impl RenderOnce for PanelRow {
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement {
let id = self.id.clone();
let gutter = rems(0.5).to_pixels(window.rem_size());
let gutter = cx.theme().spacing.unit * 2.0;
let main = island(
div()
+6 -4
View File
@@ -9,9 +9,11 @@ use gpui::{
InteractiveElement as _, IntoElement, KeyDownEvent, MouseButton, MouseDownEvent,
MouseMoveEvent, MouseUpEvent, ParentElement as _, Pixels, Point, RenderOnce, Role,
SharedString, StatefulInteractiveElement as _, StyleRefinement, Styled as _, Window, canvas,
deferred, div, fill, point, px, rems,
deferred, div, fill, point, px,
};
use gpui_native_theme::{
ActiveTheme as _, BORDER_WIDTH, DISABLED_OPACITY, HAIRLINE_WIDTH, RESIZE_KEYBOARD_STEP,
};
use gpui_native_theme::{ActiveTheme as _, BORDER_WIDTH, HAIRLINE_WIDTH, RESIZE_KEYBOARD_STEP};
use gpui_native_utils::{StyledExt as _, focus_handle, focus_ring};
/// How far one keyboard arrow step moves the seam.
@@ -108,7 +110,7 @@ impl RenderOnce for ResizeHandle {
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement {
let theme = cx.theme();
let ring = theme.colors.ring;
let thickness = rems(0.5).to_pixels(window.rem_size());
let thickness = theme.spacing.unit * 2.0;
let label = self
.accessibility_label
@@ -150,7 +152,7 @@ impl RenderOnce for ResizeHandle {
handle.w_full().h(thickness)
})
.refine_style(&self.style)
.when(self.disabled, |handle| handle.opacity(0.5))
.when(self.disabled, |handle| handle.opacity(DISABLED_OPACITY))
.when(!self.disabled, |handle| {
handle
.track_focus(&focus)
+2 -5
View File
@@ -23,9 +23,6 @@ use gpui_native_theme::ActiveTheme as _;
use gpui::Decorations;
#[cfg(any(target_os = "windows", target_os = "linux"))]
use gpui::SharedString;
#[cfg(target_os = "windows")]
use gpui::px;
/// macOS traffic-lights zone: the pad a leading titlebar strip reserves.
pub use gpui_native_theme::TRAFFIC_LIGHT_PAD;
#[cfg(target_os = "windows")]
@@ -232,7 +229,7 @@ fn caption_button(
close: bool,
) -> AnyElement {
let theme = cx.theme();
let glyph_size = theme.sizes.small.caption_size;
let glyph_size = theme.sizes.small.dense_icon_size;
let hover = if close {
WINDOWS_CLOSE_HOVER
@@ -250,7 +247,7 @@ fn caption_button(
.flex()
.items_center()
.justify_center()
.w(px(CAPTION_WIDTH))
.w(CAPTION_WIDTH)
.h_full()
.window_control_area(area)
.text_color(if enabled {