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). - 16 built-in themes:
default,catppuccin-mocha,catppuccin-latte,dracula,nord,gruvbox,tokyo-night,solarized-dark,solarized-light,one-dark,rose-pine,monokai,porsche,colorblind,high-contrast,mono. Every theme (except the terminal-nativedefault/mono) passes WCAG AA for text. - 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
Until published on crates.io, depend on the git repository:
[]
= { = "https://github.com/sorinirimies/tui-nuances" }
# with serde support:
# tui-nuances = { git = "https://github.com/sorinirimies/tui-nuances", 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 – swatches of every theme, t/T cycle |
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.

