π¨ ratatui-themes
Beautiful, consistent color themes for ratatui terminal UI applications.
Features β’ Installation β’ Quick Start β’ Themes β’ API β’ Examples
β¨ Features
- π¨ 15+ Popular Themes β Dracula, Nord, Catppuccin, Gruvbox, Tokyo Night, and more
- π Easy Theme Cycling β Built-in
next()/prev()methods for theme switchers - π¦ Serde Support β Optional serialization for saving theme preferences
- π Light/Dark Detection β Programmatically determine if a theme is light or dark
- π― Semantic Colors β Consistent
error,warning,success,infoacross all themes - β‘ Zero Dependencies β Only requires
ratatui(and optionallyserde)
π¦ Installation
Add to your Cargo.toml:
[]
= "0.1"
With serde support for configuration files:
[]
= { = "0.1", = ["serde"] }
π Quick Start
use ;
use Style;
// Create a theme
let theme = new;
// Access the color palette
let palette = theme.palette;
// Apply colors to styles
let title_style = default
.fg
.bg;
let error_style = default
.fg;
let muted_text = default
.fg;
π¨ Available Themes
| Theme | Type | Preview | Description |
|---|---|---|---|
| Dracula | π Dark | #bd93f9 |
Iconic dark purple aesthetic |
| One Dark Pro | π Dark | #61afef |
Atom's beloved dark theme |
| Nord | π Dark | #88c0d0 |
Arctic, bluish color palette |
| Catppuccin Mocha | π Dark | #cba6f7 |
Warm, soothing pastel dark |
| Catppuccin Latte | βοΈ Light | #8839ef |
Warm pastel light variant |
| Gruvbox Dark | π Dark | #fabd2f |
Retro groove colors |
| Gruvbox Light | βοΈ Light | #d79921 |
Retro groove, light mode |
| Tokyo Night | π Dark | #7aa2f7 |
Futuristic Tokyo cityscape |
| Solarized Dark | π Dark | #268bd2 |
Precision-engineered colors |
| Solarized Light | βοΈ Light | #268bd2 |
Solarized for bright rooms |
| Monokai Pro | π Dark | #ffd866 |
Classic syntax colors |
| RosΓ© Pine | π Dark | #c4a7e7 |
Natural, muted elegance |
| Kanagawa | π Dark | #7e9cd8 |
Inspired by Hokusai's art |
| Everforest | π Dark | #a7c080 |
Comfortable forest green |
| Cyberpunk | π Dark | #ff00ff |
Neon-soaked futuristic |
π§ API Reference
ThemePalette
Every theme provides a consistent color palette with semantic meaning:
Theme Cycling
Build theme switchers with ease:
use ThemeName;
let mut current = Dracula;
// Cycle forward through all themes
current = current.next; // -> OneDarkPro
// Cycle backward
current = current.prev; // -> Dracula
// Get all available themes
let all_themes = all;
Light/Dark Detection
use ;
let theme = new;
if theme.is_light
if theme.is_dark
Serde Integration
Save and load theme preferences (requires serde feature):
use ThemeName;
use ;
// Serializes as: { "theme": "tokyo-night" }
// Theme names use kebab-case for human readability
π Examples
Complete TUI App Example
use ;
use ;
Status Bar with Semantic Colors
use ;
π€ Contributing
Contributions are welcome! Here's how you can help:
- π Report bugs β Open an issue describing the problem
- π‘ Suggest themes β Request popular themes to be added
- π§ Submit PRs β Add new themes or improve existing ones
Adding a New Theme
- Add the theme variant to
ThemeNameenum insrc/theme.rs - Implement the palette in
ThemePalette::from_name() - Add to
ThemeName::all()list - Update the README theme table
- Add tests
π License
MIT License β see LICENSE for details.
Made with β€οΈ for the ratatui community