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
//! Catppuccin-inspired color palette for terminal output.
//!
//! Uses standard ANSI bright colors for maximum terminal compatibility,
//! mapped to approximate Catppuccin Frappe aesthetics.
//!
//! Color palette inspired by [Catppuccin](https://github.com/catppuccin/catppuccin),
//! a community-driven pastel theme. See their repository for the full palette specification.
use colored::{ColoredString, Colorize};
/// Declares [`CatppuccinExt`] and its blanket impl from one
/// `palette_name => ansi_method` row per color, so the trait and the impl
/// can't drift apart.
macro_rules! palette {
($($(#[$doc:meta])* $name:ident => $ansi:ident,)+) => {
/// Extension trait for applying Catppuccin-inspired colors to strings.
/// Uses ANSI bright colors for maximum compatibility.
pub trait CatppuccinExt {
$($(#[$doc])* fn $name(&self) -> ColoredString;)+
}
impl<S: AsRef<str>> CatppuccinExt for S {
$(fn $name(&self) -> ColoredString {
self.as_ref().$ansi()
})+
}
};
}
palette! {
// Accent colors
/// Rosewater → bright white (closest to light pink).
rosewater => bright_white,
/// Flamingo → bright red (light coral).
flamingo => bright_red,
/// Pink → bright magenta.
pink => bright_magenta,
/// Mauve → bright purple.
mauve => bright_purple,
/// Red → bright red.
ctp_red => bright_red,
/// Maroon → red.
maroon => red,
/// Peach → bright yellow (orange-ish).
peach => bright_yellow,
/// Yellow → bright yellow.
ctp_yellow => bright_yellow,
/// Green → bright green.
ctp_green => bright_green,
/// Teal → cyan.
teal => cyan,
/// Sky → bright cyan.
sky => bright_cyan,
/// Sapphire → bright cyan.
sapphire => bright_cyan,
/// Blue → bright blue.
ctp_blue => bright_blue,
/// Lavender → bright purple.
lavender => bright_purple,
// Text colors
/// Text → bright white.
text => bright_white,
/// Subtext1 → white.
subtext1 => white,
/// Subtext0 → white.
subtext0 => white,
/// White → bright white.
ctp_white => bright_white,
// Overlay colors
/// Overlay2 → white (the lightest overlay).
overlay2 => white,
/// Overlay1 → bright black (gray).
overlay1 => bright_black,
/// Overlay0 → bright black (gray).
overlay0 => bright_black,
// Surface colors (dark grays)
/// Surface2 → bright black.
surface2 => bright_black,
/// Surface1 → bright black.
surface1 => bright_black,
/// Surface0 → bright black.
surface0 => bright_black,
}