返回 CodeWhale
lib.rs
根目录 / crates / palette / src / lib.rs
1 //! Codewhale color palette and semantic roles.
2 //!
3 //! This crate defines the color system for the TUI in three layers:
4 //!
5 //! 1. **RGB tuples** (`*_RGB` constants) — raw color values used by theme
6 //! generation and runtime palette construction.
7 //! 2. **Semantic `Color` constants** — pre-computed `ratatui::style::Color`
8 //! values mapped to UI roles (surface, text, accent, status, mode).
9 //! 3. **Backward-compatible aliases** (`DEEPSEEK_*`) — legacy names that
10 //! delegate to the current Whale palette constants.
11 //!
12 //! ## Features
13 //!
14 //! `ratatui` (default) enables layers 2 and 3, themes, adaptation, contrast
15 //! math and terminal background detection. Without it the crate is only the
16 //! renderer-free core: the RGB tuples, [`ThemeId`] and theme-name / hex
17 //! colour normalizers, so a headless settings layer can validate
18 //! `theme = "..."` without linking ratatui.
19
20 mod ids;
21 mod rgb;
22
23 #[cfg(feature = "ratatui")]
24 mod adapt;
25 #[cfg(feature = "ratatui")]
26 mod contrast;
27 #[cfg(feature = "ratatui")]
28 mod detect;
29 #[cfg(feature = "ratatui")]
30 pub mod grammar;
31 #[cfg(feature = "ratatui")]
32 pub mod osc11;
33 #[cfg(feature = "ratatui")]
34 mod themes;
35 #[cfg(feature = "ratatui")]
36 mod tokens;
37 #[cfg(feature = "ratatui")]
38 mod user_theme;
39
40 #[cfg(all(test, feature = "ratatui"))]
41 mod tests;
42
43 pub use ids::*;
44 pub use rgb::*;
45
46 #[cfg(feature = "ratatui")]
47 #[allow(unused_imports)]
48 pub use adapt::*;
49 #[cfg(feature = "ratatui")]
50 #[allow(unused_imports)]
51 pub use contrast::*;
52 #[cfg(feature = "ratatui")]
53 #[allow(unused_imports)]
54 pub use detect::*;
55 #[cfg(feature = "ratatui")]
56 #[allow(unused_imports)]
57 pub use grammar::{ChromeInk, SemanticFamily, chrome_style};
58 #[cfg(feature = "ratatui")]
59 #[allow(unused_imports)]
60 pub use osc11::*;
61 #[cfg(feature = "ratatui")]
62 #[allow(unused_imports)]
63 pub use themes::*;
64 #[cfg(feature = "ratatui")]
65 pub use tokens::*;
66 #[cfg(feature = "ratatui")]
67 pub use user_theme::*;
68
68 lines RUST