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.1":

FeatureDescriptionDependencies
builtin-themes20 embedded TOML themes via include_str!None
gradientsMulti-stop gradient support (Gradient type)None
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
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 (enables global-state + builtin-themes)

Configuration Examples

toml
# Default — builtins + gradients + ratatui
[dependencies]
opaline = "0.1"

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

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

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

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

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

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

# Everything
[dependencies]
opaline = { version = "0.1", features = [
    "builtin-themes", "gradients", "ratatui",
    "cli", "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()
global-state + builtin-themesload_theme_by_name(), load_theme_by_name_with()

| global-state + builtin-themes + discovery | load_theme_by_name_for_app(), load_theme_by_name_for_app_with() |

Without Default Features

With default-features = false, you get:

  • OpalineColor, OpalineStyle, OpalineError
  • Theme, ThemeBuilder
  • load_from_str(), load_from_file()
  • 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.