Expand description
Design tokens shared by the neuro-kitchen apps, and their application to gpui-kit’s theme, so every gpui-kit component (buttons, menus, inputs, tooltips) and the apps’ own layout use one set of values.
- Spacing on the 8 px grid with a 4 px half-step:
XS4,SM8,MD12,LG16,XL24,XXL32 (designparser8pt-grid,4pt-system). - Type: base
FONT_SIZE15 px, so gpui’stext_xs≈ 11 (captions),text_sm≈ 13 (body),text_base15 (titles),text_lg≈ 17 (headings); weights 400 and 600 only. The sizes are relative to the base, so a larger base in Settings scales every one of them. - Radii by tier:
RADIUS_SM4 (chips, swatches),RADIUS6 (controls),RADIUS_LG8 (sections, panes, dialogs) (designparsercorner-radius-tone: neutral, one per tier). - Panes are rounded cards
PANE_GAPapart on the chrome, withPANE_PADDINGinside (padding ≥ 1.5 × gap: designparserpadding-gap-ratio). - Type: IBM Plex Sans for the interface, IBM Plex Mono for code, paths, ids and numbers in
columns (
fonts: bundled through the app’s assets, the system fonts until they load). - Neutrals are shared greys with a slight cool bias (
color); data sits oncolor::canvasand takes thecolor::DATAcolours in order; a selection is the accent at 16 % with a 1 px edge (color::selection); the accent is the app’s (Palette) unless the user picked another colour (Look::accent, anyRgb: made to pass contrast).
The look (dark or light, palette, accent, text size) is process-wide: set it with set_look, then
apply hands it to gpui-kit and redraws every window.
Re-exports§
pub use color::Colors;pub use color::DATA;pub use color::colors;pub use color::contrast;pub use color::data;pub use color::mix;pub use color::rgb8;pub use color::rgb_hsla;pub use palette::Accent;pub use palette::Palette;pub use palette::Rgb;
Modules§
- color
- The colours: shared neutrals (greys with a slight cool bias: surfaces from the deepest, text,
borders), the data ground (
canvas,grid), status colours, the selection, and the accent (super::Look::active_palette), resolved for the current look. The values are the Design System’s tokens (tokens.json), one for one. - fonts
- The type families: IBM Plex Sans for the interface, IBM Plex Mono for code, paths, ids and
numbers in columns (tabular digits). Both are under the SIL Open Font License, so every app
ships them: the files go in the app’s assets at
FILES(withcrate::icons::AppAssets::file), thenloadhands them to the text system beforesuper::apply. Until they load, or if the app ships none, the system’s fonts are used and nothing else changes. - palette
- Accent colours. The neutrals are shared (
super::color); each app supplies a defaultPalette(dsp-kitchenPalette::LIME, lucemPalette::TEAL, garnishPalette::PAPRIKA, kitchen-orchestratePalette::AMBER, kitchenPalette::COBALT), and the user may pick any colour instead (Rgb, stored in the app’s preferences):Palette::from_rgbturns it into light and dark accents that pass WCAG contrast.
Structs§
- Look
- What the user chose: dark or light, an accent of their own or the app’s, the base text size.
Constants§
- CONTROL_
MIN_ W - Narrowest a row’s control gets before it drops under its label (px).
- FONT_
RANGE - Smallest and largest base text size Settings may choose (px).
- FONT_
SIZE - Base text size (px) by default.
- LABEL_W
- Width of a row’s label (
crate::widgets::row) (px). - LG
- Spacing: padding of panels (px).
- MD
- Spacing: padding inside sections and boxes (px).
- PANE_
GAP - Gap between panes on the chrome (px).
- PANE_
PADDING - Padding inside a pane (px).
- RADIUS
- Corner radius of controls: buttons, inputs, menus (px).
- RADIUS_
LG - Corner radius of large things: boxed sections, panes, dialogs (px).
- RADIUS_
SM - Corner radius of small things: chips, swatches, scrub labels (px).
- SM
- Spacing: the base unit; gaps between controls and rows (px).
- TARGET_
MIN - Smallest pointer target (px): WCAG 2.2 AA (designparser
touch-target). - XL
- Spacing: between groups (px).
- XS
- Spacing: a hairline step, icon gaps (px).
- XXL
- Spacing: around page-level blocks (px).
Functions§
- apply
- Applies the current look (
set_look) and the tokens to gpui-kit’s theme, and redraws every window. - is_dark
- Whether the current look is dark.
- look
- The current look.
- set_
look - Sets the look every colour reads.
applythen hands it to gpui-kit. - sp
pxof a token.- system_
dark - Whether the system shows
windowdark (for a theme that follows the system). - use_
look - Sets the look and applies it (
set_look, thenapply).