Skip to main content

Module theme

Module theme 

Source
Expand description

The theme: palette + sizing tokens + color scheme, exposed as a gpui Global so any component can resolve themed values during render.

Mirrors Mantine’s MantineProvider model — a single source of truth for colors, spacing, radius and typography, with semantic colors derived from the active light/dark ColorScheme.

Structs§

Color
An opaque 24-bit color.
CssColorError
Returned when a CSS color string can’t be parsed.
Overrides
Per-theme semantic color overrides (opaque). None means “use the scheme-derived default”. Populated via the Theme::with_* builders.
Palette
The full set of named colors. Resolved by ColorName.
Scale
Five px values addressed by Size. Used for spacing, radius and font.
Shades
A 10-step shade ramp for a single named color.
Theme
The active theme. Install once with Theme::init, read with theme.

Enums§

ColorName
One of the named colors in the theme palette.
ColorScheme
Light or dark surface treatment. Drives every semantic color.
Size
A named size on the xs..xl scale. The library default is Md.

Functions§

css
Parse a CSS color string into an Hsla.
hsl
An opaque color from hue (degrees) and saturation/lightness (0..=100).
hsla
A color from hue (degrees), saturation/lightness (0..=100), and alpha.
mantine
The default Mantine palette.
rgb
An opaque color from 8-bit channels.
rgba
A color from 8-bit channels plus alpha in 0.0..=1.0.
theme
Read the active theme. Panics if Theme::init was never called.