pub struct Theme {
pub meta: Meta,
pub ansi: Ansi,
pub semantic: Semantic,
pub ui: Ui,
pub base24: Base24Slots,
}Expand description
A complete TCA theme definition.
All color fields contain resolved #rrggbb hex strings.
Fields§
§meta: MetaTheme metadata.
ansi: AnsiANSI 16-color definitions derived from base24 slots.
semantic: SemanticSemantic color roles derived from base24 slots.
ui: UiUI element colors derived from base24 slots.
base24: Base24SlotsRaw base24 color slots for direct interoperability.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn from_base24_slots(slots: Base24Slots) -> Self
pub fn from_base24_slots(slots: Base24Slots) -> Self
Construct a Theme by deriving all fields from a set of base24 slots.
Sourcepub fn from_base24_str(src: &str) -> Result<Self>
pub fn from_base24_str(src: &str) -> Result<Self>
Parse a base24 YAML string and construct a Theme.
Accepts the flat key: "value" YAML subset used by Base16/24 scheme files.
Theme name is read from the scheme key (with name as a fallback).
Sourcepub fn from_raw_slots(slots: &HashMap<String, String>) -> Result<Self>
pub fn from_raw_slots(slots: &HashMap<String, String>) -> Result<Self>
Build a Theme from a parsed [RawSlots] map (e.g. from parse_base24).
Sourcepub fn from_name(name: &str) -> Theme
pub fn from_name(name: &str) -> Theme
Creates a Theme by name, searching in order:
- User theme files (if
fsfeature enabled). - Built-in themes.
- Built-in default (if not found).
The name is case-insensitive and accepts any common case format
("Nord Dark", "nord-dark", "NordDark" all work).
Sourcepub fn from_default_cfg() -> Theme
pub fn from_default_cfg() -> Theme
Creates a Theme from the user’s configured default.
Reads $XDG_CONFIG_HOME/tca/tca.toml if the fs feature is enabled.
For a guaranteed no-I/O default, use BuiltinTheme::default().theme().
Fallback order:
- User config
default_theme(iffsfeature enabled). - Built-in default.
Sourcepub fn from_default_dark_cfg() -> Theme
pub fn from_default_dark_cfg() -> Theme
Creates a dark Theme from the user’s configured dark default.
Fallback order:
- User config
default_dark_theme(iffsfeature enabled). - Built-in default dark theme.
Sourcepub fn from_default_light_cfg() -> Theme
pub fn from_default_light_cfg() -> Theme
Creates a light Theme from the user’s configured light default.
Fallback order:
- User config
default_light_theme(iffsfeature enabled and theme is light). - Built-in default light theme.
Sourcepub fn name_slug(&self) -> String
pub fn name_slug(&self) -> String
Returns the kebab-case slug for the theme name.
e.g. "Tokyo Night" -> "tokyo-night"
Sourcepub fn to_filename(&self) -> String
pub fn to_filename(&self) -> String
Returns the canonical file name for the theme.
e.g. "Tokyo Night" -> "tokyo-night.yaml"
Sourcepub fn to_pathbuf(&self) -> Result<PathBuf>
pub fn to_pathbuf(&self) -> Result<PathBuf>
Returns the canonical install path for the theme in the user themes directory.
Sourcepub fn to_base24_str(&self) -> String
pub fn to_base24_str(&self) -> String
Serialize this theme to a base24 YAML string.
The output is a flat key: "value" YAML file compatible with the
Tinted Theming base24 format.
Hex values are written as 6-character lowercase strings without a leading #.
Trait Implementations§
impl Eq for Theme
Source§impl Ord for Theme
impl Ord for Theme
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for Theme
Two themes are equal if they have the same name slug, regardless of color values.
This means "Nord Dark", "nord-dark", and "nordDark" are all considered equal.
impl PartialEq for Theme
Two themes are equal if they have the same name slug, regardless of color values.
This means "Nord Dark", "nord-dark", and "nordDark" are all considered equal.