tca-types
Core type definitions for Terminal Colors Architecture (TCA).
Overview
Provides domain types for representing TCA themes. This crate is format-agnostic and contains no I/O or rendering logic.
Installation
[]
= "0.1"
Usage
use Theme;
// Themes are deserialized from TOML
let theme: Theme = from_str?;
// Resolve palette references to hex colors
let color = theme.resolve; // Returns Some("#ff5555")
let direct = theme.resolve; // Returns Some("#ff0000")
// Convert hex to RGB
use hex_to_rgb;
let = hex_to_rgb?;
Type Structure
Theme
- Theme - Name, author, version, description
- Ansi - 16 ANSI color definitions
- Palette - Neutral and hue ramps (red, blue, green, etc.)
- Base16 - Optional Base16 scheme
- Semantic - Optional semantic colors (error, warning, etc.)
- Ui - Optional UI colors (background, foreground, etc.)
Color References
TCA supports two reference formats:
- Hex colors:
#ff0000 - Palette references:
palette.red.5
The Theme::resolve() method resolves references to hex values.
Serialization
All types derive Serialize and Deserialize for use with serde.
License
MIT