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
134
135
136
137
138
139
140
141
142
143
//! The Beam Design Language theme system for photon-ui.
//!
//! Provides color palettes, semantic tokens, ANSI rendering, and
//! composable text styles for terminal UIs.
//!
//! # Quick start
//!
//! ```
//! use photon_ui::theme::{
//! Palette,
//! Style,
//! Theme,
//! stylize,
//! };
//!
//! Theme::set(Theme::Light);
//! let accent = Theme::palette().accent();
//! let styled = stylize("Hello", &Style::new().fg(accent).bold());
//! ```
//!
//! # Switching themes on demand
//!
//! ```
//! use photon_ui::theme::{
//! Palette,
//! Theme,
//! };
//!
//! Theme::set(Theme::Dark);
//! assert_eq!(Theme::palette().background().to_hex(), "#1f1f1f");
//!
//! Theme::set(Theme::Light);
//! assert_eq!(Theme::palette().background().to_hex(), "#fffaed");
//! ```
//!
//! # Custom palettes
//!
//! Implement [`Palette`] and install it globally with [`Theme::set_palette`].
//! While installed, components resolve colors through the custom palette
//! instead of the built-in Light/Dark themes.
//!
//! ```
//! use std::sync::Arc;
//!
//! use photon_ui::theme::{
//! Color,
//! Palette,
//! PaletteHandle,
//! Theme,
//! };
//!
//! #[derive(Debug)]
//! struct NeonPalette;
//!
//! impl Palette for NeonPalette {
//! fn background(&self) -> Color {
//! Color::from_hex("#0a0a0a").unwrap()
//! }
//!
//! fn surface(&self) -> Color {
//! Color::from_hex("#141414").unwrap()
//! }
//!
//! fn field(&self) -> Color {
//! Color::from_hex("#1e1e1e").unwrap()
//! }
//!
//! fn text(&self) -> Color {
//! Color::from_hex("#f0f0f0").unwrap()
//! }
//!
//! fn text_muted(&self) -> Color {
//! Color::from_hex("#888888").unwrap()
//! }
//!
//! fn text_on_accent(&self) -> Color {
//! Color::from_hex("#ffffff").unwrap()
//! }
//!
//! fn accent(&self) -> Color {
//! Color::from_hex("#ff00ff").unwrap()
//! }
//!
//! fn accent_hover(&self) -> Color {
//! Color::from_hex("#ff44ff").unwrap()
//! }
//!
//! fn border(&self) -> Color {
//! Color::from_hex("#333333").unwrap()
//! }
//!
//! fn border_muted(&self) -> Color {
//! Color::from_hex("#222222").unwrap()
//! }
//!
//! fn focus(&self) -> Color {
//! Color::from_hex("#ff00ff").unwrap()
//! }
//!
//! fn success(&self) -> Color {
//! Color::from_hex("#00ff00").unwrap()
//! }
//!
//! fn warning(&self) -> Color {
//! Color::from_hex("#ffff00").unwrap()
//! }
//!
//! fn error(&self) -> Color {
//! Color::from_hex("#ff0000").unwrap()
//! }
//!
//! fn info(&self) -> Color {
//! Color::from_hex("#00ffff").unwrap()
//! }
//! }
//!
//! Theme::set_palette(Arc::new(NeonPalette));
//! assert_eq!(Theme::palette().accent().to_hex(), "#ff00ff");
//! Theme::clear_palette();
//! ```
pub use ;
pub use Color;
pub use ;
pub use ;