Skip to main content

Module style

Module style 

Source
Expand description

Style system for named styles, aliases, and YAML-based stylesheets.

This module provides the complete styling infrastructure:

§Core Types

§YAML Stylesheet Parsing

§YAML Schema

# Simple style with attributes
header:
  fg: cyan
  bold: true

# Shorthand for single attribute
bold_text: bold
accent: cyan

# Shorthand for multiple attributes
warning: "yellow italic"

# Adaptive style with mode-specific overrides
panel:
  bg: gray
  light:
    bg: "#f5f5f5"
  dark:
    bg: "#1a1a1a"

# Aliases
disabled: muted

§Color Formats

fg: red               # Named (16 ANSI colors)
fg: bright_yellow     # Bright variants
fg: 208               # 256-color palette
fg: "#ff6b35"         # RGB hex
fg: [255, 107, 53]    # RGB tuple

§Example

use standout::style::{parse_stylesheet, ThemeVariants};
use standout::ColorMode;

let yaml = r#"
header:
  fg: cyan
  bold: true
footer:
  dim: true
  light:
    fg: black
  dark:
    fg: white
"#;

let variants = parse_stylesheet(yaml).unwrap();
let dark_styles = variants.resolve(Some(ColorMode::Dark));

Structs§

StyleAttributes
Parsed style attributes from YAML.
Styles
A collection of named styles.
StylesheetRegistry
Registry for stylesheet/theme resolution from multiple sources.
ThemeVariants
Theme variants containing styles for base, light, and dark modes.

Enums§

ColorDef
Parsed color definition from stylesheet.
StyleDefinition
Parsed style definition from YAML.
StyleValidationError
Error returned when style validation fails.
StyleValue
A style value that can be either a concrete style or an alias to another style.
StylesheetError
Error type for stylesheet parsing failures.

Constants§

DEFAULT_MISSING_STYLE_INDICATOR
Default prefix shown when a style name is not found.
STYLESHEET_EXTENSIONS
Recognized stylesheet file extensions in priority order.

Functions§

parse_css
Parses a CSS stylesheet and builds theme variants.
parse_stylesheet
Parses a YAML stylesheet and builds theme variants.