Expand description
gpui toolkit connector for native-theme.
Maps native_theme::ResolvedThemeVariant data to gpui-component’s theming system.
§Quick Start
ⓘ
use native_theme_gpui::from_preset;
let (theme, resolved) = from_preset("catppuccin-mocha", true)?;Or from the OS-detected theme:
ⓘ
use native_theme_gpui::from_system;
let (theme, resolved) = from_system()?;§Manual Path
For full control over the resolve/validate/convert pipeline:
ⓘ
use native_theme::ThemeSpec;
use native_theme_gpui::to_theme;
let nt = ThemeSpec::preset("catppuccin-mocha").unwrap();
let variant = nt.into_variant(false).unwrap();
let resolved = variant.into_resolved().unwrap();
let theme = to_theme(&resolved, "Catppuccin Mocha", false);§Theme Field Coverage
The connector maps a subset of ResolvedThemeVariant fields to gpui-component’s
ThemeColor (108 color fields) and ThemeConfig (font/geometry).
| Category | Mapped | Notes |
|---|---|---|
defaults colors | All 20+ | background, foreground, accent, danger, etc. |
defaults geometry | radius, radius_lg, shadow | Font family/size also mapped |
button | 4 of 14 | primary_background/foreground, background/foreground (colors only) |
tab | 5 of 9 | All colors, sizing not mapped |
sidebar | 2 of 2 | background, foreground |
window | 2 of 10 | title_bar_background, border |
input | 2 of 12 | border, caret |
scrollbar | 2 of 7 | thumb, thumb_hover |
slider, switch | 2 each | fill/thumb colors |
progress_bar | 1 of 5 | fill |
list | 1 of 11 | alternate_row |
popover | 2 of 4 | background, foreground |
| 14 other widgets | 0 fields | checkbox, menu, tooltip, dialog, etc. |
Why the gap: gpui-component’s ThemeColor is a flat color bag with no per-widget
geometry. The connector cannot map most sizing/spacing data because the target type
has no corresponding fields. Users who need per-widget geometry can read it directly
from the ResolvedThemeVariant they passed to to_theme().
Modules§
- icons
- Icon conversion functions for the gpui connector.
Structs§
- Resolved
Theme Variant - A fully resolved theme where every field is guaranteed populated.
- System
Theme - Result of the OS-first pipeline. Holds both resolved variants.
- Theme
Spec - A complete native theme with a name and optional light/dark variants.
- Theme
Variant - A single light or dark theme variant containing all visual properties.
Enums§
- Animated
Icon - An animated icon, either frame-based or transform-based.
- Error
- Errors that can occur when reading or processing theme data.
- Icon
Data - Icon data returned by loading functions.
- Icon
Role - Semantic icon roles for cross-platform icon resolution.
- IconSet
- Known icon sets that provide platform-specific icon identifiers.
- Linux
Desktop - Desktop environments recognized on Linux.
- Transform
Animation - A CSS-like transform animation applied to a single icon.
Traits§
- Icon
Provider - Trait for types that map icon identifiers to platform-specific names and SVG data.
- System
Theme Ext - Extension trait for converting a
SystemThemeto a gpui-componentTheme.
Functions§
- from_
preset - Load a bundled preset and convert it to a gpui-component
Themein one call. - from_
system - Detect the OS theme and convert it to a gpui-component
Themein one call. - to_
theme - Convert a
ResolvedThemeVariantinto a gpui-componentTheme.