Skip to content

Feature Flags

Opaline uses Cargo feature flags to keep the dependency tree lean. Enable only what you need.

Default Features

These are enabled by default with opaline = "0.4":

FeatureDescriptionDependencies
builtin-themes39 embedded TOML themes via include_str!None
gradientsMulti-stop gradient support (Gradient type)unicode-segmentation 1.12
ratatuiFrom impls, inherent span()/line()/text()/gradient_text() on Themeratatui-core 0.1

Optional Features

These must be explicitly enabled:

FeatureDescriptionDependencies
clicolored crate adapter: ThemeCliExt, ColoredExt, gradient_stringcolored 3
crosstermDirect crossterm adapter: Color, ContentStyle, gradient helperscrossterm 0.29
owo-colorsZero-allocation terminal coloring: Style conversion, OwoThemeExtowo-colors 4
cssCSS custom properties + classes generation from tokens/styles/gradientsNone
syntectSyntax highlighting theme generation: Color, StyleModifier, Themesyntect 5
eguiImmediate-mode GUI adapter: Color32, Visuals from theme tokensegui 0.33
global-stateProcess-wide theme singleton: current(), set_theme()parking_lot 0.12
discoveryUser theme directory scanning: app_theme_dirs(), theme_dirs()dirs 6
widgetsTheme selector widget with live previewratatui 0.30, crossterm 0.29, unicode-width 0.2 (enables global-state + builtin-themes)

Configuration Examples

toml
# Default: builtins + gradients + ratatui
[dependencies]
opaline = "0.4"

# Minimal: just the core engine, no builtins or adapters
[dependencies]
opaline = { version = "0.4", default-features = false }

# Core + gradients only (for non-Ratatui use)
[dependencies]
opaline = { version = "0.4", default-features = false, features = ["gradients"] }

# CLI tool (colored output, no TUI)
[dependencies]
opaline = { version = "0.4", features = ["cli"] }

# Direct crossterm styling
[dependencies]
opaline = { version = "0.4", features = ["crossterm"] }

# Zero-allocation terminal coloring
[dependencies]
opaline = { version = "0.4", features = ["owo-colors"] }

# CSS generation for web frameworks (Leptos, Yew, Dioxus, Tauri)
[dependencies]
opaline = { version = "0.4", features = ["css"] }

# Syntax highlighting theme generation
[dependencies]
opaline = { version = "0.4", features = ["syntect"] }

# egui GUI theming
[dependencies]
opaline = { version = "0.4", features = ["egui"] }

# Full TUI app with global state
[dependencies]
opaline = { version = "0.4", features = ["global-state"] }

# User-configurable themes
[dependencies]
opaline = { version = "0.4", features = ["discovery"] }

# TUI app with theme picker widget
[dependencies]
opaline = { version = "0.4", features = ["widgets"] }

# Everything
[dependencies]
opaline = { version = "0.4", features = [
    "builtin-themes", "gradients", "ratatui",
    "cli", "crossterm", "owo-colors", "css",
    "syntect", "egui",
    "global-state", "discovery", "widgets"
] }

Feature Interactions

Some features gate additional API when combined:

CombinationUnlocks
ratatui + gradientstheme.gradient_text(), gradient_spans(), gradient_line(), gradient_bar(), gradient_text_line()
cli + gradientsgradient_string() (colored crate)
crossterm + gradientsgradient_styled(), gradient_bar()
owo-colors + gradientsgradient_string() (owo-colors)
css + gradientsGradient CSS custom properties as linear-gradient()
global-state + builtin-themesload_theme_by_name(), load_theme_by_name_with()
builtin-themes + discoverylist_available_themes_for_app(), list_available_themes_in_dirs()
global-state + builtin-themes + discoveryload_theme_by_name_for_app(), load_theme_by_name_for_app_with(), load_theme_by_name_in_dirs()

Without Default Features

With default-features = false, you get:

  • OpalineColor, OpalineStyle, OpalineError
  • Theme, ThemeBuilder
  • load_from_str(toml, None), load_from_file(path)
  • Schema types (ThemeFile, ThemeMeta, StyleDef)
  • Resolver pipeline

You lose:

  • No builtin themes (must provide your own TOML)
  • No gradient support
  • No Ratatui type conversions

Released under the MIT License.