Skip to main content

Module palette

Module palette 

Source
Expand description

Configurable presentation rules for the TUI ([palette] in opys.toml).

Each named entry has a list of matchers ({status?, type?}) and a style. A document matches an entry when any matcher matches (a matcher matches when every field it constrains equals the document’s). For a document, the styles of all matching entries are merged field-wise in ascending specificity (number of constrained fields in the matched matcher; ties broken by entry name), so more-specific rules override less-specific ones — a bug that is blocked can take the bug icon and the blocked color.

This module is part of the core (always compiled): the engine parses and validates the palette even without the tui feature. The TUI maps the resolved Style onto ratatui colors/modifiers; see tui::theme.

Structs§

Matcher
A match condition. All fields optional; an empty matcher matches everything.
PaletteEntry
One palette rule: when any matcher matches, its style contributes.
Style
The presentational attributes a rule can set. All optional so styles compose.

Enums§

ColorSpec
A parsed color spec. The TUI maps this onto a concrete ratatui color.
NamedColor
The ANSI-ish named colors a palette may reference (the ratatui base set).

Functions§

parse_color
Parse a color string: a name (case-insensitive), #rgb/#rrggbb hex, or a 0-255 palette index. Returns None if it is not a valid color.
resolve
Resolve the merged Style for a document from the whole palette. has_tag answers tag matchers (exact tag or tag key).