standout_render/style/mod.rs
1//! Style system for named styles, aliases, and YAML-based stylesheets.
2//!
3//! This module provides the complete styling infrastructure:
4//!
5//! ## Core Types
6//!
7//! - [`StyleValue`]: A style that can be either concrete or an alias
8//! - [`Styles`]: A registry of named styles
9//! - [`StyleValidationError`]: Errors from style validation
10//!
11//! ## YAML Stylesheet Parsing
12//!
13//! - [`parse_stylesheet`]: Parse YAML into theme variants
14//! - [`ThemeVariants`]: Styles resolved for base/light/dark modes
15//! - [`StylesheetRegistry`]: File-based theme management
16//!
17//! ## YAML Schema
18//!
19//! ```yaml
20//! # Simple style with attributes
21//! header:
22//! fg: cyan
23//! bold: true
24//!
25//! # Shorthand for single attribute
26//! bold_text: bold
27//! accent: cyan
28//!
29//! # Shorthand for multiple attributes
30//! warning: "yellow italic"
31//!
32//! # Adaptive style with mode-specific overrides
33//! panel:
34//! bg: gray
35//! light:
36//! bg: "#f5f5f5"
37//! dark:
38//! bg: "#1a1a1a"
39//!
40//! # Aliases
41//! disabled: muted
42//! ```
43//!
44//! ## Color Formats
45//!
46//! ```yaml
47//! fg: red # Named (16 ANSI colors)
48//! fg: bright_yellow # Bright variants
49//! fg: 208 # 256-color palette
50//! fg: "#ff6b35" # RGB hex
51//! fg: [255, 107, 53] # RGB tuple
52//! ```
53//!
54//! ## Example
55//!
56//! ```rust
57//! use standout::style::{parse_stylesheet, ThemeVariants};
58//! use standout::ColorMode;
59//!
60//! let yaml = r#"
61//! header:
62//! fg: cyan
63//! bold: true
64//! footer:
65//! dim: true
66//! light:
67//! fg: black
68//! dark:
69//! fg: white
70//! "#;
71//!
72//! let variants = parse_stylesheet(yaml).unwrap();
73//! let dark_styles = variants.resolve(Some(ColorMode::Dark));
74//! ```
75
76// Core style types
77mod error;
78mod registry;
79mod value;
80
81// Stylesheet parsing (YAML and CSS)
82mod attributes;
83mod color;
84mod css_parser;
85mod definition;
86mod file_registry;
87mod parser;
88
89// Core exports
90pub use error::{StyleValidationError, StylesheetError};
91pub use registry::{Styles, DEFAULT_MISSING_STYLE_INDICATOR};
92pub use value::StyleValue;
93
94// Stylesheet parsing exports
95pub use attributes::StyleAttributes;
96pub use color::ColorDef;
97pub use css_parser::parse_css;
98pub use definition::StyleDefinition;
99pub use file_registry::{StylesheetRegistry, STYLESHEET_EXTENSIONS};
100pub use parser::{parse_stylesheet, ThemeVariants};