Expand description
Token-based theme system for Git-Iris.
This module provides a flexible, TOML-configurable theme system that supports:
- Color primitives defined in a palette
- Semantic tokens that reference palette colors or other tokens
- Composed styles with foreground, background, and modifiers
- Gradient definitions for smooth color transitions
- Runtime theme switching with thread-safe global state
§Theme File Format
Themes are defined in TOML files with the following structure:
[meta]
name = "My Theme"
author = "Your Name"
variant = "dark" # or "light"
[palette]
purple_500 = "#e135ff"
cyan_400 = "#80ffea"
[tokens]
text.primary = "#f8f8f2"
accent.primary = "purple_500" # references palette
success = "cyan_400"
[styles]
keyword = { fg = "accent.primary", bold = true }
[gradients]
primary = ["purple_500", "cyan_400"]§Usage
ⓘ
use git_iris::theme;
// Get current theme
let theme = theme::current();
// Access colors
let color = theme.color("accent.primary");
// Access styles
let style = theme.style("keyword");
// Access gradients
let gradient_color = theme.gradient("primary", 0.5);Modules§
- adapters
- Adapters for converting theme types to framework-specific types.
- builtins
- Builtin themes embedded in the binary.
Structs§
- Gradient
- A color gradient defined by a series of color stops.
- Theme
- A resolved theme with all tokens and styles ready for use.
- Theme
Color - A theme color in RGB format.
- Theme
Info - Information about an available theme.
- Theme
Meta - Theme metadata.
- Theme
Style - A composed style with foreground, background, and modifiers.
Enums§
- Theme
Error - Errors that can occur when loading or resolving themes.
- Theme
Variant - Theme variant - light or dark.
Functions§
- current
- Get the current active theme.
- list_
available_ themes - List all available themes.
- load_
theme - Load and set a theme from a file path.
- load_
theme_ by_ name - Load and set a theme by name (searches discovery paths).
- set_
theme - Set the active theme.