Skip to main content

Crate opaline

Crate opaline 

Source
Expand description

§Opaline

A token-based theme engine for Ratatui TUI applications.

Opaline gives any Ratatui app TOML-driven themes with a three-layer resolution pipeline: palette (raw hex colors) → tokens (semantic names) → styles (composed fg/bg + modifiers). Themes can also define multi-stop gradients.

§Quick start

use opaline::{Theme, OpalineColor};

// Load the default builtin theme
let theme = Theme::default();

// Access semantic tokens
let accent = theme.color("accent.primary");
let style = theme.style("keyword");

§Features

FeatureDefaultDescription
builtin-themesyes13 embedded TOML themes via include_str!
gradientsyesMulti-stop gradient support
ratatuiyesFrom impls for ratatui::style::{Color, Style}
clinocolored crate adapter for ANSI terminal output
global-statenoProcess-wide current()/set_theme() singleton
discoverynoLoad user themes from ~/.config/<app>/themes/

Re-exports§

pub use color::ColorParseError;
pub use color::OpalineColor;
pub use error::OpalineError;
pub use loader::load_from_file;
pub use loader::load_from_str;
pub use schema::StyleDef;
pub use schema::ThemeFile;
pub use schema::ThemeMeta;
pub use schema::ThemeVariant;
pub use style::OpalineStyle;
pub use theme::Theme;
pub use theme::ThemeBuilder;
pub use gradient::Gradient;
pub use adapters::ratatui::gradient_bar;
pub use adapters::ratatui::gradient_line;
pub use adapters::ratatui::gradient_spans;
pub use adapters::ratatui::gradient_text_line;
pub use adapters::cli::gradient_string;
pub use adapters::cli::ColoredExt;
pub use adapters::cli::ThemeCliExt;
pub use theme::current;
pub use theme::load_theme;
pub use theme::set_theme;
pub use theme::load_theme_by_name;
pub use theme::load_theme_by_name_with;
pub use theme::load_theme_by_name_for_app;
pub use theme::load_theme_by_name_for_app_with;
pub use builtins::ThemeInfo;
pub use builtins::list_available_themes;
pub use builtins::load_by_name;
pub use discovery::app_theme_dirs;
pub use discovery::theme_dirs;
pub use widgets::ThemeSelector;
pub use widgets::ThemeSelectorAction;
pub use widgets::ThemeSelectorState;

Modules§

adapters
builtins
color
discovery
error
gradient
loader
names
String constants for the standard theme contract.
resolver
schema
style
theme
widgets
Reusable theme widgets for Ratatui applications.