tca-types 0.1.0

Core type definitions for Terminal Colors Architecture
Documentation

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

[dependencies]
tca-types = "0.1"

Usage

use tca_types::Theme;

// Themes are deserialized from TOML
let theme: Theme = toml::from_str(toml_content)?;

// Resolve palette references to hex colors
let color = theme.resolve("palette.red.5"); // Returns Some("#ff5555")
let direct = theme.resolve("#ff0000");       // Returns Some("#ff0000")

// Convert hex to RGB
use tca_types::hex_to_rgb;
let (r, g, b) = hex_to_rgb("#ff5555")?;

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