#[non_exhaustive]pub struct ThemeTokens {Show 54 fields
pub appearance: ThemeAppearance,
pub touch: bool,
pub base: SemanticThemeTokens,
pub selected: Hsla,
pub link: Hsla,
pub tooltip: Hsla,
pub tooltip_foreground: Hsla,
pub scrim: Hsla,
pub dialog_overlay: Hsla,
pub sidebar: Hsla,
pub sidebar_border: Hsla,
pub sidebar_accent: Hsla,
pub sidebar_selected: Hsla,
pub sidebar_muted_foreground: Hsla,
pub text_control: TextStyleToken,
pub text_heading: TextStyleToken,
pub text_title: TextStyleToken,
pub metrics: MetricTokens,
pub disabled_opacity: f32,
pub terminal_cursor_opacity: f32,
pub switch_track_on: Hsla,
pub switch_track_off: Hsla,
pub switch_thumb: Hsla,
pub success: Hsla,
pub warning: Hsla,
pub info: Hsla,
pub destructive_solid: Hsla,
pub success_solid: Hsla,
pub warning_solid: Hsla,
pub info_solid: Hsla,
pub solid_foreground: Hsla,
pub destructive_tint: Hsla,
pub success_tint: Hsla,
pub warning_tint: Hsla,
pub info_tint: Hsla,
pub progress_track: Hsla,
pub popover: Hsla,
pub popover_foreground: Hsla,
pub popover_border: Hsla,
pub popover_accent: Hsla,
pub popover_separator: Hsla,
pub popover_muted_foreground: Hsla,
pub select_indicator: Hsla,
pub select_trigger: Hsla,
pub select_trigger_border: Hsla,
pub tab_separator: Hsla,
pub field: Hsla,
pub field_border: Hsla,
pub field_focus_border: Hsla,
pub text_textarea: TextStyleToken,
pub dock_drop: Hsla,
pub dock_handle: Hsla,
pub dock_handle_hover: Hsla,
pub dock_unfocused: Hsla,
}Expand description
Everything a component reads: base’s semantic tokens plus the few
roles gpui-cn components need that base does not define. Derived from a
ThemeConfig when the theme resolves. It is never edited by hand
except through Theme::update.
Roles are added here only when a component reads them. The skill color stays on the config until then.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.appearance: ThemeAppearanceLight or dark.
touch: boolWhether a finger is the pointer. Components show no hover state and keep their row actions visible when it is.
base: SemanticThemeTokensColors, radius, spacing, typography, and shadow shared with base.
selected: HslaThe persistent selected surface: a sidebar row, a segmented choice,
a pressed toggle. Stronger than the hover surface (accent).
link: HslaLink text. The accent, lifted toward the ink on a dark surface so
it reads as text. The focus ring (ring) keeps the accent itself.
tooltip: HslaThe tooltip pill: a step above the window surface on dark, the ink on light.
tooltip_foreground: HslaText on a tooltip.
scrim: HslaThe dim over the content behind a sheet, such as the sidebar on a
phone: black at half opacity in both appearances, shadcn’s
bg-black/50 sheet overlay.
dialog_overlay: HslaThe dim behind a dialog: black at 25% alpha in both appearances. Measured from the reference app on dark: the backdrop is #121212 over the #181818 window, which is 25% black. The light value is derived from the same alpha and was not sampled.
The sidebar surface: a step above the window on dark, a hair below it on light, so the rail reads as a different plane.
The hairline between the sidebar and the content beside it.
The hover surface of a row on the sidebar: a step above the sidebar, short of the selected row, so a hovered row beside the selected one reads as two rows. The reference app paints both the same.
The selected row on the sidebar.
Group labels and other quiet text on the sidebar.
text_control: TextStyleTokenThe text of controls and rows: 13px at the default font size, the
control size of the reference app, between base’s xs and sm.
text_heading: TextStyleTokenA section heading or a sidebar title: 15px medium.
text_title: TextStyleTokenA page title: 24px semibold.
metrics: MetricTokensThe sizes of controls, rows, and window chrome.
disabled_opacity: f32The strength a disabled control keeps: 55%, measured from the reference app’s disabled button fill. A button applies it to its fill and a card to the whole. The reference app’s disabled switch measures 60%; gpui-cn keeps one strength for every control.
terminal_cursor_opacity: f32The strength of a terminal’s block cursor over the cell it covers: 55%, chosen so the glyph under the cursor stays readable without a second color.
switch_track_on: HslaThe color of a switch that is on and a radio that is chosen: the
accent, as the reference app paints a switch that is on (#539af8 on
dark). Only the switch and the radio read it, as macOS paints both
in controlAccentColor; no other component paints in the accent.
switch_track_off: HslaThe track of a switch that is off.
switch_thumb: HslaThe thumb of a switch: the lighter of the surface and the ink, so it is white in both appearances of the built-in themes, as the reference app paints it.
success: HslaPositive status, such as a success tag. The config’s success.
warning: HslaCaution status, such as a warning tag. The config’s warning.
info: HslaNeutral information, such as an info tag. The accent, so it is the theme’s own blue.
destructive_solid: HslaThe solid fill of a destructive mark, such as an alert count: the
destructive color stepped toward the darker end of surface and ink
until solid_foreground on it reaches 4.5:1, WCAG AA for text.
success_solid: HslaThe solid fill of a success mark, derived as destructive_solid.
warning_solid: HslaThe solid fill of a warning mark, derived as destructive_solid.
info_solid: HslaThe solid fill of an info mark, derived as destructive_solid.
solid_foreground: HslaText on a solid status fill: the lighter of surface and ink.
destructive_tint: HslaThe fill of a destructive status, such as a danger tag: one step from the surface toward the destructive color, scaled by contrast.
success_tint: HslaThe fill of a success status: the destructive_tint step toward
success.
warning_tint: HslaThe fill of a warning status: the destructive_tint step toward
warning.
info_tint: HslaThe fill of an info status: the destructive_tint step toward
info.
progress_track: HslaThe track of a progress bar: primary at 20%, shadcn’s
bg-primary/20. The indicator is primary itself.
popover: HslaThe surface of a menu or popover: #2d2d2d on dark, sampled from the
reference app’s select menus, a larger step above the window than
a card takes. The window surface on light, as shadcn’s popover.
popover_foreground: HslaText on a popover: the ink itself. The reference app paints menu rows white on dark where the window’s text is #dfdfdf.
popover_border: HslaThe hairline around a popover: #444444 on dark, sampled from the
reference app’s menu edge. The border token on light.
popover_accent: HslaThe highlighted row of a menu: #3d3d3d on dark, sampled from the reference app’s hovered menu row. On light the same step as a hovered sidebar row.
popover_separator: HslaA separator inside a popover: #3e3e3e on dark, sampled from the
reference app’s menus. The border step on light.
popover_muted_foreground: HslaA description under a menu row’s label: #b5b5b5 on dark, sampled
from the reference app, a step brighter than muted_foreground.
The muted_foreground step on light.
select_indicator: HslaThe check beside a selected menu row and the chevron on a select trigger: #cacaca on dark, sampled from the reference app, the ink a step toward the surface.
select_trigger: HslaThe fill of a select trigger: #2a2a2a on dark as sampled from the
reference app on the window surface (it is #343434 on a #232323
card, the same step). The derivation gives #292929, one step off
the sample, and the test asserts the derived value. The window surface on light, as shadcn’s
bg-transparent trigger.
select_trigger_border: HslaThe hairline around a select trigger: #3b3b3b on dark as sampled
from the reference app. The derivation gives #3a3a3a, one step off
the sample, and the test asserts the derived value. The input token on light, as shadcn’s
border-input.
tab_separator: HslaThe hairline between two unselected tabs: the muted text at 60%, which the tab reference app paints #707070 over its #181818 bar.
field: HslaThe fill of a text field: #2c2c2c on dark, sampled from the
reference app’s settings textarea at 2x on the #181818 window. The
window surface on light, as shadcn’s bg-transparent input.
field_border: HslaThe hairline around a text field at rest: #3b3b3b on dark, sampled
from the reference app’s select trigger, the same family. The
input token on light, as shadcn’s border-input.
field_focus_border: HslaThe hairline around a text field while the caret is inside: #799ec8
on dark, sampled from the reference app’s focused textarea at 2x,
the link color most of the way over the fill. One pixel, no spread.
The ring itself on light, as shadcn’s border-ring.
text_textarea: TextStyleTokenThe text of a multi-line field: 13px on an 18.5px line, the pitch
measured from the reference app’s settings textarea at 2x (37px),
looser than text_control so lines of prose read apart.
dock_drop: HslaThe slot a lifted pane of a dock leaves and the place it will land:
the accent at 30%, the drop overlay of Ghostty’s splits
(Color.accentColor.opacity(0.3) in
macos/Sources/Features/Splits/TerminalSplitTreeView.swift).
dock_handle: HslaThe ellipsis on a pane’s grab handle at rest: the text color at
30%, Ghostty’s .primary.opacity(0.3) in
macos/Sources/Ghostty/Surface View/SurfaceGrabHandle.swift.
dock_handle_hover: HslaThe ellipsis on a hovered grab handle: the text color at 80%,
Ghostty’s .primary.opacity(0.8) in the same file.
dock_unfocused: HslaThe fill over a pane of a split that does not have focus: the
background at 30%, Ghostty’s default unfocused-split-opacity of 0.7
with unfocused-split-fill left to the background
(src/config/Config.zig).
Implementations§
Source§impl ThemeTokens
impl ThemeTokens
Sourcepub fn colors(&self) -> &ColorTokens
pub fn colors(&self) -> &ColorTokens
The color tokens shared with base.
Sourcepub fn background(&self) -> Hsla
pub fn background(&self) -> Hsla
The window background.
Sourcepub fn foreground(&self) -> Hsla
pub fn foreground(&self) -> Hsla
Default text.
Sourcepub fn primary_foreground(&self) -> Hsla
pub fn primary_foreground(&self) -> Hsla
Text on a primary surface.
Sourcepub fn secondary_foreground(&self) -> Hsla
pub fn secondary_foreground(&self) -> Hsla
Text on a secondary surface.
Sourcepub fn muted_foreground(&self) -> Hsla
pub fn muted_foreground(&self) -> Hsla
Descriptions, placeholders, helper text.
Sourcepub fn accent_foreground(&self) -> Hsla
pub fn accent_foreground(&self) -> Hsla
Text on an accent surface.
Sourcepub fn destructive(&self) -> Hsla
pub fn destructive(&self) -> Hsla
Destructive actions and error emphasis.
Sourcepub fn destructive_foreground(&self) -> Hsla
pub fn destructive_foreground(&self) -> Hsla
Text on a destructive surface.
Sourcepub fn focus_ring(&self) -> Hsla
pub fn focus_ring(&self) -> Hsla
The keyboard focus ring a control paints outside its box: the ring
color at half strength, shadcn’s ring/50.
Sourcepub fn font_family(&self) -> &SharedString
pub fn font_family(&self) -> &SharedString
Interface font family.
Sourcepub fn mono_font_family(&self) -> &SharedString
pub fn mono_font_family(&self) -> &SharedString
Code font family.
Sourcepub fn radius_full(&self) -> Pixels
pub fn radius_full(&self) -> Pixels
As round as the shape allows: circles and pills.
Trait Implementations§
Source§impl Clone for ThemeTokens
impl Clone for ThemeTokens
Source§impl Debug for ThemeTokens
impl Debug for ThemeTokens
Source§impl PartialEq for ThemeTokens
impl PartialEq for ThemeTokens
impl StructuralPartialEq for ThemeTokens
Auto Trait Implementations§
impl Freeze for ThemeTokens
impl RefUnwindSafe for ThemeTokens
impl Send for ThemeTokens
impl Sync for ThemeTokens
impl Unpin for ThemeTokens
impl UnsafeUnpin for ThemeTokens
impl UnwindSafe for ThemeTokens
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more