tui-nuances
Shared theming for ratatui widget libraries. Build one
Theme, style every component of your app from it: tui-chart, tui-slider,
tui-spinner, tui-rating, tui-piechart, tui-checkbox, tui-file-explorer
and your own widgets.

Features
- One
Themewith ~30 named slots: UI (foreground,muted,border,border_focused,primary,selection_bg/fg…), status (success,warning,error,info) and data-viz (palette,bull,bear,axis,grid,crosshair, tooltip). - 104 built-in themes (
Theme::names()lists them in cycling order). The cycle starts withdefaultand 19 dark themes, then 20 light ones, then 20 dark, the remaining 9 light, and the rest dark, so light themes show up early without flashing on every step (catppuccin-mocha/catppuccin-latte,solarized-dark/solarized-light,github-dark/github-light,gruvbox/gruvbox-light,tokyo-night/tokyo-night-day…).- Light (29):
default-light,catppuccin-latte,solarized-light,github-light,gruvbox-light,tokyo-night-day,rose-pine-dawn,atom-one-light,ayu-light,everforest-light,dayfox,kanagawa-lotus,flexoki-light,modus-operandi,alabaster,edge-light,selenized-light,bluloco-light,papercolor-light,synthwave-dawn,tokyo-night-light,light-owl,gruvbox-material-light,dawnfox,material-lighter,iceberg-light,clair-obscur-canvas,mario-overworld,meadow. - Synthwave:
synthwave,synthwave-outrun,synthwave-dawn,retrowave,vaporwave,laserwave,fairyfloss,neon,cyberpunk. - Dark:
dracula,nord,monokai,one-dark,rose-pine,kanagawa-wave,nightfox,night-owl,material-palenight,iceberg,horizon,oxocarbonand ~50 more, plus game-inspired ones (super-mario,mario-underground,pip-boy,hyrule,doom,tarnished,clair-obscur,test-chamber,cavern-hush,dojo,underworld,summit,rain-noir,blocky…) andporsche. - Accessibility:
colorblind(Okabe–Ito),high-contrast,mono. Every theme (except the terminal-nativedefault/mono) passes WCAG AA for text.
- Light (29):
- Derive a theme from what you have:
Theme::from_base(..),Theme::from_palette(..). - Semantic styles:
style(),muted_style(),border_style(focused),title_style(),selected_style(),disabled_style(),status_style(Status). - Color math (
tui_nuances::color): mix / lighten / darken, relative luminance, contrast ratio,readable_on,ensure_contrast, 256/16-color quantisation. - Terminal aware:
ColorSupport::detect()(COLORTERM,TERM,NO_COLOR) andTheme::downgrade(support). - Glue traits:
Themed(widgets) andThemeProvider(your app theme type). ThemeSwitcherfor demos and settings screens.- Optional
serdefeature: themes load from flat JSON/TOML-style maps of color strings.
Installation
# with serde support:
or in Cargo.toml:
[]
= "0.1"
# with serde support:
# tui-nuances = { version = "0.1", features = ["serde"] }
Quick start
use ;
use ;
let theme = by_name.unwrap_or_default;
let panel = default
.borders
.border_style // focused border
.title_style
.style; // fg + bg
let status = new.style;
Derive from your own colors
use Color;
use Theme;
let theme = from_base
.warning; // every slot has a builder setter
Plug in your app's theme type
use ;
Widget crates implement Themed { fn apply_theme(self, &Theme) -> Self }; then
widget.themed(&app_theme) or widget.apply_theme(&theme) works everywhere.
Adapt to the terminal
use Theme;
let theme = dracula.downgrade_for_terminal; // honours NO_COLOR / COLORTERM / TERM
Examples
| Example | Run | Demo |
|---|---|---|
gallery – all themes on paged tiles (dark first, then light), n/p page |
cargo run --example gallery |
![]() |
semantic – mock UI using only semantic styles |
cargo run --example semantic |
![]() |
switcher – ThemeSwitcher + color downgrade |
cargo run --example switcher |
![]() |
Regenerate the GIFs with nu scripts/generate_all_tapes.nu (vhs required).
Migrating from tui-chart's Theme
All chart fields keep their names (background, foreground, muted, axis, grid,
border, title, palette, bull, bear, neutral, accent, crosshair,
tooltip_fg, tooltip_bg) and the helpers base_style, axis_style, label_style,
grid_style, fill, color(i), next/prev, all are available.
Development
See CONTRIBUTING.md. Licensed under MIT.

