refactor: add native ui theme tokens

This commit is contained in:
ZacharyZhang-NY committed 2026-04-19 01:36:21 -04:00
1 parent 5e6e929779
commit 308be17264
14 files changed
+248 -108

No files matched your search

@@ -1,4 +1,5 @@
use gpui::{Context, SharedString, Window, div, prelude::*, rgb};
use crate::theme;
use gpui::{Context, SharedString, Window, div, prelude::*};
pub fn primary_button<V>(
label: &'static str,
@@ -14,9 +15,9 @@ where
.py_2()
.rounded_md()
.cursor_pointer()
.bg(rgb(0x9e3d2d))
.text_color(rgb(0xfff7f0))
.hover(|style| style.bg(rgb(0xb24f3e)))
.bg(theme::primary_action())
.text_color(theme::primary_action_text())
.hover(|style| style.bg(theme::primary_action_hover()))
.on_click(
cx.listener(move |this, _: &gpui::ClickEvent, _: &mut Window, cx| on_click(this, cx)),
)
@@ -37,11 +38,11 @@ where
.py_2()
.rounded_md()
.cursor_pointer()
.bg(rgb(0xfffbf5))
.bg(theme::panel())
.border_1()
.border_color(rgb(0xd9cdbf))
.text_color(rgb(0x171411))
.hover(|style| style.bg(rgb(0xf4ede4)))
.border_color(theme::panel_border())
.text_color(theme::text_primary())
.hover(|style| style.bg(theme::panel_hover()))
.on_click(
cx.listener(move |this, _: &gpui::ClickEvent, _: &mut Window, cx| on_click(this, cx)),
)
@@ -1,9 +1,9 @@
use crate::theme;
use gpui::{
App, Bounds, Context, CursorStyle, Element, ElementId, ElementInputHandler, Entity,
EntityInputHandler, FocusHandle, Focusable, GlobalElementId, KeyBinding, LayoutId, MouseButton,
MouseDownEvent, PaintQuad, Pixels, Point, ShapedLine, SharedString, Style, TextRun,
UTF16Selection, Window, actions, div, fill, hsla, point, prelude::*, px, relative, rgb, size,
white,
UTF16Selection, Window, actions, div, fill, hsla, point, prelude::*, px, relative, size, white,
};
use std::ops::Range;
use unicode_segmentation::UnicodeSegmentation;
@@ -371,7 +371,7 @@ impl Element for TextElement {
point(cursor_x, bounds.top()),
size(px(2.0), bounds.bottom() - bounds.top()),
),
rgb(0x9e3d2d),
theme::primary_action(),
);
PrepaintState { line, cursor }
}
@@ -422,9 +422,9 @@ impl Render for TextInput {
.on_action(cx.listener(Self::paste))
.on_action(cx.listener(Self::show_character_palette))
.on_mouse_down(MouseButton::Left, cx.listener(Self::on_mouse_down))
.bg(rgb(0xfffbf5))
.bg(theme::panel())
.border_1()
.border_color(rgb(0xd9cdbf))
.border_color(theme::panel_border())
.rounded_md()
.px_3()
.py_2()