Skip to main content

Module theme

Module theme 

Source
Expand description

The painted scheme: what color returns on the current frame.

A palette change does not snap: the painted scheme blends from wherever it is toward the new target on the slow effects spring, and a further change retargets from the current paint. Reduced motion paints the target at once.

Functions§

advance_component_theme
Advance Material paint and its enabled Component projection before Root rendering. Call from theme/scale events and next-frame callbacks, not from Render. Returns whether the animation needs another frame; the caller owns scheduling and should retain only one pending callback. This function never schedules an animation itself. Base-only callers remain supported.
applyDeprecated
Paint preference resolved against the system appearance. Call at the start of each root render; it schedules frames while a transition runs. Returns whether the paint changed this frame, so an application can mirror the scheme into other toolkits only when needed.
apply_paletteDeprecated
Paint one palette, transitioning from the current paint.
apply_scaleDeprecated
Set the text scale: 14px is 1rem at 100%, and every rem token follows it.
apply_scheme
Apply a complete custom semantic scheme with the same animated transitions.
blend
Linear interpolation between two GPUI colors: Color::blend, the one implementation, applied to GPUI’s color type.
color
The current paint of a role.
init_component_theme
Enable the Component theme bridge after gpui_kit::init, before opening a window or returning its content builder. Initialize from the final startup palette and scale, including capture overrides, so the first Root preparation sees the correct colors and rem size. Returns false when Component is absent. No transition is started for this initial paint. The bridge owns the sans family from Material’s current body type scale, its base size and projected colors. The projection does not own monospace fonts or unrelated geometry; Component mode configurations retain their normal behavior for those fields.
is_dark
Whether the painted scheme is a dark one. Mid-transition this follows whichever palette the paint is closer to.
rgba
Convert a kit color to GPUI’s.
scheme
The current paint as a whole, e.g. to mirror it into another toolkit’s theme.
system_dark
Whether the system currently asks for a dark appearance.