Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/facett

.nornir/theming.md

Theming facett

facett is themable: one palette drives every component, set once on the egui context. Ships a family of striking palettes (themes+effects landed ce91f1f): default, sci_fi (neon-on-near-black HUD), nordic_aurora (fjord-night blue + aurora green), cyberpunk_neon (magenta + electric cyan), amber_crt (warm phosphor terminal), deep_space (near-black indigo void + nebula violet), and hugin_noir (the raven's own raven-black / bone-white / blood-red).

Use it

use facett::{set_theme, Theme};

// once per frame (cheap), or whenever it changes:
set_theme(ctx, Theme::sci_fi());   // or Theme::default(), Theme::hugin_noir(), …

set_theme does two things: stores the Theme on the context and applies a matching egui::Visuals (so buttons/grids/progress bars fit too). Every facet then reads it automatically — no per-component wiring.

The palette

Theme is a flat set of Color32s: bg, node_fill, node_stroke, edge, text, text_dim, accent, point, panel_bg, panel_stroke, and glow (+ a name). The custom-painted components (draw, DepGraphView, MapView) read every colour from it via facett_core::theme(ui).

glow is the colour the effects module blooms/shimmers with. It mirrors accent for the legacy palettes (default/sci-fi) but the striking themes pick a distinct glow — aurora-green for nordic, magenta for cyberpunk, blood for hugin-noir.

Enumerate them (picker / CLI --theme)

Per the CLI-parity rule, every palette is reachable without the GUI:

Theme::ALL          // &[fn() -> Theme] — every theme in picker order
Theme::names()      // Vec<&'static str> — "default", "sci-fi", "nordic-aurora", …
Theme::by_name(s)   // Option<Theme> — case-insensitive; '-'/'_'/spaces interchangeable

by_name("Nordic Aurora"), "nordic-aurora", "NORDIC_AURORA" all resolve to the same theme; an unknown name returns None. A dropdown iterates Theme::ALL; a --theme flag funnels through by_name.

Make your own theme

let mut t = Theme::default();
t.name = "amber";
t.accent = egui::Color32::from_rgb(255, 180, 40);
t.point  = egui::Color32::from_rgb(255, 200, 80);
set_theme(ctx, t);

The rule for component authors

A themed component must pull its colours from theme(ui), never hardcode them — that's what makes a new theme apply everywhere at once. The headless harness::render_themed(facet, Theme::sci_fi()) asserts the themed paint path works (it's in the MEGA matrix). When you add a component, theme it and add it to that test.

Effects

Motion + bloom (easing, glow_rect/glow_text/shimmer, ParticleBurst, the signature RavenSprite) live alongside the palette — they paint with the theme's glow. See effects.md.

Roadmap