Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Web docs

Framework guide: GPUI

Zero-dependency Rust crate delivering Lumen’s 8 presets (16 themes), 100+ gpui-component color tokens, Zed-compatible syntax highlighting, pure-Rust custom palettes, bundled OFL variable fonts, and Lucide SVG assets for GPUI desktop apps.

Crate
lumen-gpui-theme
Dependencies
0 required
Themes
14 + custom

lumen-gpui-theme ships zero required runtime dependencies so your desktop app stays insulated from pre-1.0 upstream gpui / gpui-kit churn. Pair it with gpui-kit / gpui-component (or lumen-gpui-ce on gpui-ce) for desktop widgets, or use its to_u32_rgb() / to_hsla() helpers directly in raw GPUI.

Interactive ThemeSet preview

Every preset below reads directly from the generated packages/gpui-theme/themes/lumen-*.json files shipped inside the crate (100+ ThemeConfigColors keys plus harmonized syntax highlighting).

Loading GPUI theme preview…

Installation

Requires Rust 1.88 or later. Default installation adds zero transitive crates; opt into fonts and icons only when your app needs bundled variable TrueType faces or Lucide SVG assets.

Cargo

bash
cargo add lumen-gpui-theme

Minimal Cargo.toml

toml
[dependencies]
lumen-gpui-theme = "6.0"

With bundled fonts & Lucide icons

toml
[dependencies]
lumen-gpui-theme = { version = "6.0", features = ["fonts", "icons"] }
FeatureStatusWhat it adds
(core)Default (zero deps)Typed tokens, all 8 presets (16 themes), 100+ gpui-component colors + syntax highlighting, and runtime custom palette generator.
fontsOptionalEmbeds Inter, Manrope, Bricolage Grotesque, Montserrat, and Geist variable TTF fonts (OFL 1.1) for cx.text_system().add_fonts(...).
iconsOptionalEmbeds the full Lucide interface SVG catalog (ISC) with icons::load_asset_path for GPUI AssetSource.

Apply themes in gpui-kit / gpui-component

Deserialize any embedded ThemeSet JSON straight into gpui-component’s Theme::update. Every widget—buttons, tables, lists, tabs, switches, sliders, scrollbars, charts, status bar, and Tree-sitter syntax highlighting—picks up Lumen’s palette automatically.

Load fonts & apply a Lumen preset

rust
use std::rc::Rc;

use gpui_kit::component::{Theme, ThemeSet};
use gpui_kit::App;
use lumen_gpui_theme::{LumenPreset, LumenScheme, gpui_component_theme_name};

pub fn apply_lumen_theme(preset: LumenPreset, scheme: LumenScheme, cx: &mut App) {
    // Load Lumen's bundled variable TTF fonts (requires the `fonts` feature).
    let _ = cx.text_system().add_fonts(lumen_gpui_theme::fonts::all_font_bytes());

    let set: ThemeSet = serde_json::from_str(preset.theme_set_json())
        .expect("embedded Lumen ThemeSet JSON is valid");
    let target = gpui_component_theme_name(preset, scheme);

    if let Some(config) = set.themes.into_iter().find(|theme| theme.name.as_ref() == target) {
        Theme::update(cx, |theme| theme.apply_config(&Rc::new(config)));
    }
}

Built-in presets

All eight presets ship both LumenScheme::Light and LumenScheme::Dark from canonical tokens/lumen.tokens.json values.

PresetThemeSet JSONTypefaceCharacter
LumenPreset::Studiothemes/lumen-studio.jsonInterDense, quiet pro-tool look with compact density, flat cards, and hairline borders.
LumenPreset::Defaultthemes/lumen-default.jsonInterLumen 6 balanced foundation with crisp contrast and soft elevation.
LumenPreset::Paperthemes/lumen-paper.jsonInterWarm editorial surfaces with serif heading preference and tight radii.
LumenPreset::Luminousthemes/lumen-luminous.jsonManropeHigh-clarity teal/violet surfaces with Manrope typography and pill controls.
LumenPreset::Voltagethemes/lumen-voltage.jsonInterHigh-contrast technical preset with compact density and ring borders.
LumenPreset::Signalthemes/lumen-signal.jsonBricolage GrotesqueExpressive Bricolage Grotesque preset with crisp offset shadows.
LumenPreset::Classicthemes/lumen-classic.jsonMontserratLumen 5 visual continuity with Montserrat headings and flat cards.
LumenPreset::Aurathemes/lumen-aura.jsonGeistBright AI and developer-tool look with Geist type and glow elevation. Its web brand gradient falls back to the solid brand color.

Runtime custom palettes

Need a product brand color or user-customizable workspace theme? create_palette walks lightness steps in pure Rust until every text, surface, and solid action pair passes WCAG AA (4.5:1) or AAA (7.0:1), then exports a complete gpui-component ThemeSet JSON.

Generate a brand theme at runtime

rust
use std::rc::Rc;

use gpui_kit::component::{Theme, ThemeSet};
use gpui_kit::App;
use lumen_gpui_theme::prelude::*;

pub fn apply_custom_brand(brand_hex: &str, scheme: LumenScheme, cx: &mut App) {
    let seeds = LumenPaletteSeeds::from_hex(brand_hex)
        .expect("valid #RRGGBB brand color")
        .with_contrast(LumenPaletteContrast::Aa);
    let palette = create_palette(seeds);
    let json = palette.to_gpui_component_theme_set_json("Acme Studio", LumenPreset::Studio);

    let set: ThemeSet = serde_json::from_str(&json).expect("generated ThemeSet is valid");
    let target = if scheme.is_dark() { "Acme Studio Dark" } else { "Acme Studio Light" };

    if let Some(config) = set.themes.into_iter().find(|theme| theme.name.as_ref() == target) {
        Theme::update(cx, |theme| theme.apply_config(&Rc::new(config)));
    }
}

Raw GPUI tokens & Lucide AssetSource

Building custom elements directly on gpui? Use LumenColor::to_u32_rgb(), to_u32_rgba(), and to_hsla(), and delegate icons/lumen/*.svg paths inside your AssetSource.

Raw GPUI styling

rust
use gpui::{div, hsla, prelude::*, px, rgb};
use lumen_gpui_theme::prelude::*;

fn studio_card() -> impl IntoElement {
    let theme = LumenPreset::Studio.dark();
    let [h, s, l, a] = theme.palette.brand.to_hsla();

    div()
        .bg(rgb(theme.palette.surface.to_u32_rgb()))
        .text_color(rgb(theme.palette.ink.to_u32_rgb()))
        .border_1()
        .border_color(rgb(theme.palette.line.to_u32_rgb()))
        .rounded(px(theme.radii.md))
        .p(px(theme.spacing().md))
        .child(div().text_color(hsla(h, s, l, a)).child("Lumen Studio on GPUI"))
}

Lucide AssetSource (icons feature)

rust
use std::borrow::Cow;

use gpui_kit::{AssetSource, Result, SharedString};
use lumen_gpui_theme::icons;

pub struct LumenAssets;

impl AssetSource for LumenAssets {
    fn load(&self, path: &str) -> Result<Option<Cow<'static, [u8]>>> {
        if let Some(bytes) = icons::load_asset_path(path) {
            return Ok(Some(Cow::Owned(bytes)));
        }

        gpui_kit::assets::Assets.load(path)
    }

    fn list(&self, path: &str) -> Result<Vec<SharedString>> {
        gpui_kit::assets::Assets.list(path)
    }
}

GPUI Community Edition (gpui-ce)

gpui-ce is a community fork of Zed's GPUI. For widgets, theme switching, and the theme picker, use lumen-gpui-ce. lumen-gpui-theme has no GPUI dependency, so its typed tokens, bundled fonts, and Lucide icons also work there unchanged on plain elements. The ThemeSet JSON needs gpui-component, which pins Zed's gpui-pre.

GPUI flavorTokens, fonts & iconsThemeSet JSONLumen widgets
gpui-kit / gpui-component 0.12 (gpui-pre)YesYeslumen-gpui
Zed gpuiYesThrough gpui-component onlyThrough lumen-gpui on gpui-kit only
gpui-ce 0.3YesNo: gpui-component pins gpui-prelumen-gpui-ce

Cargo.toml for plain elements

toml
[dependencies]
gpui = { package = "gpui-ce", version = "0.3" }
gpui_platform = { package = "gpui_ce_platform", version = "0.3" }
lumen-gpui-theme = { version = "6.0", features = ["fonts", "icons"] }

Fonts, colors & window launch

rust
use gpui::{App, AsyncApp, Rgba, rgba};
use lumen_gpui_theme::prelude::*;

fn color(token: LumenColor) -> Rgba {
    rgba(token.to_u32_rgba())
}

pub fn run(cx: &mut App) {
    let _ = cx.text_system().add_fonts(lumen_gpui_theme::fonts::all_font_bytes());

    // gpui-ce 0.3.0 deadlocks on macOS when this callback opens a window directly.
    cx.spawn(async |cx: &mut AsyncApp| cx.update(open_window)).detach();
}

Run the plain gpui-ce example

bash
CARGO_TARGET_DIR=/tmp/lumen-gpui-ce-target cargo run --manifest-path packages/gpui-theme/examples/gpui-ce/Cargo.toml

lumen-gpui: setup, theme picker & AI widgets

lumen-gpui builds on gpui-kit 0.12 and this crate. One init call registers the fonts and installs a preset, theme switches survive gpui-component's system-appearance sync, and the AI widgets follow the same contracts as Lumen's web, Dioxus, and native components. It doesn't run on gpui-ce; use lumen-gpui-ce there.

WidgetKindReports
PromptComposerView (Entity)Submit, Stop, and Change events
StreamMessageElementNothing; shows status, actions, and sources
ReasoningElementon_toggle, driven by ReasoningDisclosure
ToolActivityElementon_toggle for its body
ApprovalCardElementon_response with the request id and decision
LumenThemePickerElementon_change after a preset or scheme switch
StatElementNothing

Cargo.toml

toml
[dependencies]
gpui-kit = "0.12"
lumen-gpui = "6.0"

Set up the app

rust
use lumen_gpui::prelude::*;

fn main() {
    gpui_kit::application()
        .with_assets(LumenAssets)
        .run(|cx| {
            // Sets up gpui-kit, registers Lumen's fonts, and installs Studio in the system scheme.
            lumen_gpui::init_with(LumenGpuiOptions::new(LumenPreset::Studio), cx);
            // Open windows with gpui_kit::open_window, then render LumenThemePicker::new("theme").
        });
}

Run the agent workbench example

bash
CARGO_TARGET_DIR=/tmp/lumen-gpui-target cargo run --example workbench --manifest-path packages/gpui/Cargo.toml

lumen-gpui-ce: the same widgets on gpui-ce

lumen-gpui-ce gives gpui-ce 0.3 apps the widgets in the table above, drawn with gpui-ce's own elements instead of gpui-component. It also exports Button, Badge, and Spinner for your own views, and root(cx) as the window root that moves focus on Tab and Shift+Tab. Every control publishes its role, name, and state to the platform's accessibility API. Requires Rust 1.95 or later; see the crate README.

Cargo.toml

toml
[dependencies]
gpui = { package = "gpui-ce", version = "0.3" }
gpui_platform = { package = "gpui_ce_platform", version = "0.3" }
lumen-gpui-ce = "6.0"

Set up the app

rust
use gpui::{Context, IntoElement, ParentElement as _, Render, Window};
use lumen_gpui_ce::prelude::*;

struct Home;

impl Render for Home {
    fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
        // Paints the theme's canvas and moves focus on Tab and Shift+Tab.
        lumen_gpui_ce::root(cx)
            .child(LumenThemePicker::new("theme"))
            .child(Stat::new("Pass rate", "98.4%").trend("+2.1%", StatTrendTone::Success))
    }
}

fn main() {
    gpui_platform::application()
        .with_assets(LumenAssets)
        .run(|cx| {
            // Registers Lumen's fonts, binds the keys, and installs Studio in the system scheme.
            lumen_gpui_ce::init_with(LumenGpuiOptions::new(LumenPreset::Studio), cx);
            // gpui-ce 0.3.0 deadlocks on macOS when this callback opens a window directly,
            // so open the Home window from cx.spawn, as the crate README shows.
        });
}

Run the gpui-ce workbench example

bash
CARGO_TARGET_DIR=/tmp/lumen-gpui-ce-target cargo run --example workbench --manifest-path packages/gpui-ce/Cargo.toml -- paper light

Run the native desktop showcase

Launch the standalone gpui-kit 0.12 showcase crate in this repository to inspect all 16 themes, bundled variable fonts, and Lucide SVGs in a real GPU-rendered window. Also see Dioxus for full Rust component parity and Tauri v2 for webview-based Rust desktop apps.

Run locally (keep Cargo target outside the repo)

bash
CARGO_TARGET_DIR=/tmp/lumen-gpui-showcase-target cargo run --manifest-path packages/gpui-theme/examples/showcase/Cargo.toml
Web docsFull catalog