load_builtin_theme

Function load_builtin_theme 

Source
pub fn load_builtin_theme(
    name: &str,
    variant: ThemeVariant,
) -> Result<AppTheme, String>
Available on crate feature theme only.
Expand description

Loads a builtin theme by name.

Builtin themes are embedded in the crate and don’t require external files. Use BUILTIN_THEMES to see available theme names.

§Arguments

  • name - The name of the builtin theme (e.g., “gruvbox”, “dracula”)
  • variant - Which theme variant (dark/light) to use

§Returns

Ok(AppTheme) if the theme exists and can be loaded, Err with a description if the theme doesn’t exist.

§Example

use ratatui_toolkit::services::theme::{loader, ThemeVariant};

let theme = loader::load_builtin_theme("gruvbox", ThemeVariant::Dark)
    .expect("Failed to load gruvbox theme");