-
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
-
144
-
145
-
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
-
194
-
195
-
196
-
197
-
198
-
199
-
200
-
201
-
202
-
203
-
204
-
205
-
206
-
207
-
208
-
209
-
210
-
211
-
212
-
213
-
214
-
215
-
216
-
217
-
218
-
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
-
229
-
230
-
231
-
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
-
242
-
243
-
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
-
255
-
256
-
257
-
258
-
259
-
260
-
261
-
262
-
263
-
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
-
274
-
275
-
276
-
277
-
278
-
279
-
280
-
281
-
282
-
283
-
284
-
285
-
286
-
287
-
288
-
289
-
290
-
291
# Copyright 2023 Shota FUJI <pockawoooh@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#
# SPDX-License-Identifier: 0BSD
{
config,
lib,
pkgs,
...
}:
let
cfg = config.themes.catppuccin;
radius = 2;
gap = 16;
in
{
options = {
themes.catppuccin = {
flavor = lib.mkOption {
type = lib.types.enum [
"latte"
"frappe"
"macchiato"
"mocha"
];
default = "mocha";
description = ''
Specify which Catppuccin _flavor_ (color palette) to use.
'';
};
};
};
config =
let
json = builtins.fromJSON (
builtins.readFile (
pkgs.fetchFromGitHub {
owner = "catppuccin";
repo = "palette";
rev = "205dd54c6158b7648621cf9fd00e91f03888ce7e";
sha256 = "y14fd8lvnG9hNY6CRU0JgxWouexEw91aIEMkr1NaM/4=";
}
+ "/palette.json"
)
);
flavor = json."${cfg.flavor}";
stripSharp = hex: lib.strings.removePrefix "#" hex;
darkFlavor = if cfg.flavor == "latte" then "mocha" else cfg.flavor;
dark = json."${darkFlavor}";
light = json.latte;
in
{
features.wayland-de = lib.mkIf config.features.wayland-de.enable {
niri = {
background-color = "transparent";
overview = {
backdrop-color = flavor.base.hex;
};
layout = {
focus-ring = {
width = 1;
active-color = flavor.overlay1.hex;
inactive-color = flavor.surface1.hex;
};
border = {
width = gap / 5;
active-color = flavor.overlay2.hex;
inactive-color = flavor.surface0.hex;
};
gaps = gap;
struts.bottom = gap / -2;
};
window-rule-all = {
corner-radius = radius;
};
};
walker = {
css = ''
#window.dark {
--background-color: ${flavor.base.hex};
--surface-background-color: ${flavor.surface0.hex};
--border-color: ${flavor.lavender.hex};
--foreground-color: ${flavor.text.hex};
--dimmed-foreground-color: ${flavor.subtext0.hex};
}
#window.light {
--background-color: ${json.latte.base.hex};
--surface-background-color: ${json.latte.surface0.hex};
--border-color: ${json.latte.lavender.hex};
--foreground-color: ${json.latte.text.hex};
--dimmed-foreground-color: ${json.latte.subtext0.hex};
}
'';
};
swaylock = {
flags = [
"color=${stripSharp flavor.base.hex}"
"indicator-thickness=8"
"indicator-idle-visible"
"inside-color=${stripSharp flavor.base.hex}"
"inside-clear-color=${stripSharp flavor.base.hex}"
"inside-ver-color=${stripSharp flavor.base.hex}"
"inside-wrong-color=${stripSharp flavor.base.hex}"
"key-hl-color=${stripSharp flavor.mauve.hex}"
"line-color=${stripSharp flavor.surface0.hex}"
"line-clear-color=${stripSharp flavor.surface0.hex}"
"line-ver-color=${stripSharp flavor.overlay2.hex}"
"line-wrong-color=${stripSharp flavor.red.hex}"
"ring-color=${stripSharp flavor.base.hex}"
"ring-clear-color=${stripSharp flavor.base.hex}"
"ring-ver-color=${stripSharp flavor.overlay0.hex}"
"ring-wrong-color=${stripSharp flavor.maroon.hex}"
"text-color=${stripSharp flavor.text.hex}"
"text-clear-color=${stripSharp flavor.text.hex}"
"text-ver-color=${stripSharp flavor.subtext1.hex}"
"text-wrong-color=${stripSharp flavor.red.hex}"
];
};
};
services.dunst = lib.mkIf config.services.dunst.enable {
settings = {
global = {
width = 400;
height = 300;
offset = "4x4";
padding = 4;
horizontal_padding = 8;
frame_width = 2;
gap_size = 6;
font = "Monospace 10";
corner_radius = 2;
};
urgency_low = {
background = flavor.base.hex;
foreground = flavor.subtext0.hex;
frame_color = flavor.overlay1.hex;
};
urgency_normal = {
background = flavor.base.hex;
foreground = flavor.text.hex;
frame_color = flavor.blue.hex;
};
urgency_critical = {
background = flavor.base.hex;
foreground = flavor.text.hex;
frame_color = flavor.yellow.hex;
};
};
};
programs.waybar = lib.mkIf config.programs.waybar.enable {
settings = {
main = {
position = "bottom";
};
};
};
xdg.configFile =
let
baseStyle = ''
* {
font-family: Roboto, Helvetica, Arial, sans-serif;
font-size: 16px;
}
window#waybar {
font-weight: bold;
}
.module {
padding: 2px 4px;
margin: 4px;
border-radius: 3px;
}
#clock,
#network,
#pulseaudio,
#tray {
color: inherit;
}
'';
in
{
"waybar/style-light.css".text = ''
${baseStyle}
window#waybar {
background-color: ${light.base.hex};
color: ${light.text.hex};
}
#tray {
background-color: ${light.sapphire.hex};
}
#pulseaudio:hover {
background-color: ${light.surface0.hex};
}
'';
"waybar/style-dark.css".text = ''
${baseStyle}
window#waybar {
background-color: ${dark.base.hex};
color: ${dark.text.hex};
}
#tray {
background-color: transparent;
}
#pulseaudio:hover {
background-color: ${dark.surface0.hex};
}
'';
};
programs.ghostty =
let
darkFlavor = if cfg.flavor == "latte" then "mocha" else cfg.flavor;
in
{
settings = {
theme = "light:catppuccin-latte-corrected,dark:catppuccin-${darkFlavor}";
};
themes.catppuccin-latte-corrected = {
palette = [
"0=${json.latte.crust.hex}"
"1=${json.latte.red.hex}"
"2=${json.latte.green.hex}"
"3=${json.latte.yellow.hex}"
"4=${json.latte.blue.hex}"
"5=${json.latte.pink.hex}"
"6=${json.latte.teal.hex}"
"7=${json.latte.subtext0.hex}"
"8=${json.latte.surface2.hex}"
"9=#de293e"
"10=#49af3d"
"11=#eea02d"
"12=#456eff"
"13=#fe85d8"
"14=#2d9fa8"
"15=${json.latte.text.hex}"
];
background = stripSharp json.latte.base.hex;
foreground = stripSharp json.latte.text.hex;
cursor-color = stripSharp json.latte.rosewater.hex;
selection-background = stripSharp json.latte.surface2.hex;
selection-foreground = stripSharp json.latte.text.hex;
};
};
};
}