Terminal Colors Architecture (TCA) Specification

March 28, 2026 ยท View on GitHub

Version: 0.4.0
Status: Draft

Overview

Terminal Colors Architecture (TCA) is a specification for defining terminal application color themes in a structured, portable format for use by developers and theme authors. TCA uses Tinted Theming base24 as the base format specification and adds a UI/TUI semantic layer definition, theme file location, user preference configuration and library validation specifications.

Goals

  1. Portability - Single theme file works across terminals, editors, and frameworks
  2. Interoperability - Structured ANSI, Base16/24, semantic, and UI naming scheme allows for easy library integration
  3. Consistency - Structured approach to semantic color naming
  4. Accessibility - Built-in contrast validation and WCAG compliance

File Format

TCA themes are base24 YAML files following the Tinted Theming base24 schema.

File naming convention: kebab-case.yaml (e.g., nord-dark.yaml, solarized-light.yaml)

File Location

In order to facilitate theme sharing between applications, per-user theme and preference files must be located in common directories. TCA respects the XDG Directory Specification.

TCA themes must be installed into $XDG_DATA_HOME/tca/themes/ (default: ~/.local/share/tca/themes/).

User Preferences File

User preferences must be stored in a TOML file at $XDG_CONFIG_HOME/tca/tca.toml with the following structure:

[tca]
default_theme = "User Default Theme"
default_dark_theme = "user-default-dark-theme"
default_light_theme = "userDefaultLightTheme"

Theme names can be in any standard case that can be folded into kebab-case.

All entries are optional. Fallback precedence should be:

  1. Individual application preferences.
  2. default_dark_theme if defined and terminal is in dark mode.
  3. default_light_theme if defined and terminal is in light mode.
  4. default_theme if the other preferences are not defined or terminal mode is unavailable.
  5. Any defined theme if the others are not defined.

If no themes are defined or the user preference file is missing, any theme may be used.

Platform Notes

Non-XDG compliant platforms (e.g. Windows) should follow platform conventions. Use of a standard cross-platform directory library is recommended.


Semantic Mapping

TCA maps base24 fields to a structured set of names for library and application code. The tables below use dot notation (section.field) to identify fields. Library code should use idiomatic naming for the target language โ€” for example, meta.name in spec notation maps to theme.meta.name in code, and ui.fg.primary maps to theme.ui.fg_primary.

SectionDescription
metaInformation about the theme
ansi16 ANSI terminal colors
semanticSemantic colors
uiUI element colors

Metadata Fields

FieldBase24 MapDescription
namenameHuman-readable theme name
authorauthorTheme author name or organization
darkvarianttrue if variant is dark, else false

ANSI Fields

FieldBase24 Map
blackbase00
redbase08
greenbase0b
yellowbase0a
bluebase0d
magentabase0e
cyanbase0c
whitebase05
bright_blackbase03
bright_redbase12
bright_greenbase14
bright_yellowbase13
bright_bluebase16
bright_magentabase17
bright_cyanbase15
bright_whitebase07

Semantic Section

FieldBase24 MapExample Use
errorbase08Red text for errors
warningbase09Yellow/orange warnings
infobase0cCyan info text
successbase0bGreen checkmarks
highlightbase0eSelection, search results
linkbase0dClickable links

UI Section

FieldBase24 MapExample Use
fg.primarybase05Primary text color
fg.secondarybase06Secondary text color
fg.mutedbase04Muted/dimmed text
bg.primarybase00Primary background color
bg.secondarybase01Secondary/alternate background
border.primarybase02Primary border color
border.mutedbase01Subtle/muted borders
cursor.primarybase05Active cursor color
cursor.mutedbase04Inactive cursor color
selection.bgbase02Selection background
selection.fgbase05Selection foreground/text

Library Conformance

A TCA library must satisfy the following requirements.

Loading

  1. A library MUST be able to load a base24 YAML theme file from a path.
  2. A library MUST be able to load themes from the XDG theme directory.
  3. A library MUST respect the user preference fallback chain defined in this spec.
  4. A library SHOULD support loading themes by name in any common case format (snake_case, CamelCase, etc.) and fold them to kebab-case for lookup.
  5. A library MAY provide built-in themes.

Mapping

  1. A library MUST expose all fields defined in the semantic mapping tables under their canonical names.
  2. A library MUST expose colors in the native color type of its target framework or language.
  3. A library MUST expose meta.dark as a bool derived from the base24 variant field (true if variant is dark, false otherwise). When dark/light mode context is needed and the environment does not provide it, meta.dark should be used.

API

  1. A library MUST provide access to mapped fields using idiomatic naming for its language (e.g. theme.semantic.error, theme.ui.bg_primary).
  2. A library MUST provide a default theme that can be used without any theme files present.
  3. A library SHOULD provide a builder or equivalent for constructing themes programmatically.
  4. A library SHOULD expose base24 slot values directly for interoperability with non-TCA tooling.

Validation

  1. A library SHOULD warn when a loaded theme fails contrast recommendations.
  2. A library MAY provide a standalone validation tool.

Validation Rules

TCA themes must pass the following validation checks:

1. Structure Validation

  • Valid base24 syntax

For accessibility the following minimum contrast ratios are recommended:

FieldsRecommendedWarningError
fg.primary / bg.*> 4.5< 3.5< 3.0
fg.muted / bg.*> 3.0< 2.5< 2.0
semantic.* / bg.*> 4.5< 3.5< 3.0
selection.fg / selection.bg> 3.0< 2.5< 2.0
border.* / bg.*> 3.0< 2.5< 2.0
cursor.primary / bg.*> 4.5< 3.5< 3.0
cursor.muted / bg.*> 3.0< 2.5< 2.0

Design Principles

1. Prefer Semantic Names

Use semantic names (error, success) rather than base names (base00, base14) in application code.

2. Practical Accessibility Matters

Themes should meet WCAG 2.0 AA standards:

  • 4.5:1 contrast ratio for normal text
  • 3:1 for large text

However many popular existing themes do not, so the requirements are somewhat relaxed.

3. Framework Agnostic

TCA themes can be exported to any format supported by Tinted Theming:

  • Terminal configs (Kitty, Alacritty, iTerm2)
  • Editor themes (Vim, Helix, VS Code)
  • UI frameworks (Ratatui, Textual, Lipgloss)
  • Color schemes (Base16, tmux)
  • etc...

Tooling

A reference validation tool is provided, as are implementations for several languages and frameworks.

Validation

tca validate theme.yaml

Set Configuration

tca config set default "Tokyo Night"

Add Themes to User Directory

tca add "Tokyo Night"

CLI/TUI Frameworks

Reference implementations are provided for Rust, Go, and Python. Libraries are provided for integrating into the Ratatui, Lipgloss, and Textual frameworks.


Standards Compliance

This specification follows the following standards:

References


License

This specification is released to the public domain.