Skip to main content

Crate native_theme_gpui

Crate native_theme_gpui 

Source
Expand description

gpui toolkit connector for native-theme.

Maps native_theme::ResolvedTheme data to gpui-component’s theming system.

§Overview

This crate provides a thin mapping layer that converts native-theme’s platform-agnostic color, font, and geometry data into gpui-component’s Theme type. No intermediate types are introduced – the mapping goes directly from ResolvedTheme fields to gpui-component types.

§Usage

use native_theme::NativeTheme;
use native_theme_gpui::to_theme;

let nt = NativeTheme::preset("catppuccin-mocha").unwrap();
let mut variant = nt.pick_variant(false).unwrap().clone();
variant.resolve();
let resolved = variant.validate().unwrap();
let theme = to_theme(&resolved, "Catppuccin Mocha", false);

Modules§

colors
ResolvedTheme -> gpui_component::theme::ThemeColor mapping (108 fields).
config
ResolvedTheme -> gpui_component::theme::ThemeConfig mapping.
derive
Shade derivation helpers for hover/active states.
icons
Icon conversion functions for the gpui connector.

Functions§

pick_variantDeprecated
Pick a theme variant based on the requested mode.
to_theme
Convert a ResolvedTheme into a gpui-component Theme.