1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
//! Terminal Colors Architecture (TCA) theme support for ratatui.
//!
//! This crate provides utilities for loading and using TCA themes in ratatui applications.
//! Themes are [base24](https://github.com/tinted-theming/base24/) YAML files.
//!
//! ## Quick Start - StyleSet
//!
//! The easiest way to theme a ratatui app is with [`StyleSet`]. It pre-builds all the
//! common [`ratatui::style::Style`]s you need from the user's configured theme.
//!
//! ```rust,no_run
//! use tca_ratatui::StyleSet;
//! use ratatui::widgets::{Block, Borders, Paragraph};
//!
//! fn render(frame: &mut ratatui::Frame) {
//! let styles = StyleSet::default(); // user's configured theme, or built-in fallback
//!
//! let block = Block::default()
//! .borders(Borders::ALL)
//! .style(styles.border);
//!
//! let text = Paragraph::new("Hello, world!")
//! .block(block)
//! .style(styles.primary);
//!
//! frame.render_widget(text, frame.area());
//! }
//! ```
//!
//! Load by name, or cycle through available themes with [`StyleSetCursor`]:
//!
//! ```rust,no_run
//! use tca_ratatui::{StyleSet, StyleSetCursor};
//!
//! // Load a specific theme by name (any case format works)
//! let styles = StyleSet::from_name("tokyo-night");
//! let styles = StyleSet::from_name("Tokyo Night");
//!
//! // Cycle through all installed + built-in themes
//! let mut cursor = StyleSetCursor::with_all_themes();
//! cursor.next();
//! cursor.prev();
//! cursor.set_current("nord-dark");
//! let styles = cursor.peek().unwrap_or_default();
//! ```
//!
//! ## Lower-Level Access - TcaTheme
//!
//! For direct access to typed colors (e.g. for custom [`ratatui::style::Style`] composition),
//! use [`TcaTheme`] directly:
//!
//! ```rust,no_run
//! use tca_ratatui::TcaTheme;
//! use ratatui::style::Style;
//!
//! fn example() {
//! let theme = TcaTheme::from_name("tokyo-night");
//! let theme = TcaTheme::default(); // user's configured default
//!
//! // ANSI, semantic, and UI colors are all resolved
//! let error_style = Style::default().fg(theme.semantic.error);
//! let bg_style = Style::default().bg(theme.ui.bg_primary);
//! let red = theme.ansi.red;
//!
//! // Raw base24 slots
//! let base00 = theme.base24[0]; // darkest background
//! }
//! ```
//!
//! ## Parsing from YAML
//!
//! ```rust,no_run
//! use tca_ratatui::TcaTheme;
//!
//! fn example() {
//! let yaml = r#"
//! scheme: "My Theme"
//! author: "You"
//! variant: "dark"
//! base00: "1a1b26"
//! base01: "16161e"
//! base02: "2f3549"
//! base03: "444b6a"
//! base04: "787c99"
//! base05: "a9b1d6"
//! base06: "cbccd1"
//! base07: "d5d6db"
//! base08: "f7768e"
//! base09: "ff9e64"
//! base0A: "e0af68"
//! base0B: "9ece6a"
//! base0C: "7dcfff"
//! base0D: "7aa2f7"
//! base0E: "bb9af7"
//! base0F: "f7768e"
//! base10: "1a1b26"
//! base11: "16161e"
//! base12: "f7768e"
//! base13: "e0af68"
//! base14: "9ece6a"
//! base15: "7dcfff"
//! base16: "7aa2f7"
//! base17: "bb9af7"
//! "#;
//! let theme = TcaTheme::try_from(yaml).expect("Couldn't parse YAML");
//! }
//! ```
pub use StyleSet;
pub use StyleSetCursor;
pub use ;
pub use ThemeCursor;
pub use TcaThemeCursor;
pub use ColorPicker;