-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenerate.ts
83 lines (69 loc) · 2.2 KB
/
generate.ts
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
import { mkdir, writeFile } from "node:fs/promises";
import { dirname } from "node:path";
const ctpFlavors = ["latte", "frappe", "macchiato", "mocha"];
const ctpAccents = [
"rosewater",
"flamingo",
"pink",
"mauve",
"red",
"maroon",
"peach",
"yellow",
"green",
"teal",
"sky",
"sapphire",
"blue",
"lavender",
];
const flexokiVariants = ["light", "dark"];
const flexokiAccents = ["red", "orange", "yellow", "green", "cyan", "blue", "purple", "magenta"];
const ctpTemplate = ({ flavor, accent }: { flavor: string; accent: string }) =>
`
@use "../../themes/catppuccin/${flavor}" as ctp;
:root {
--modernflux-color-scheme: #{ctp.$color-scheme};
--modernflux-fg0: #{ctp.$text};
--modernflux-fg1: #{ctp.$subtext0};
--modernflux-fg2: #{ctp.$subtext1};
--modernflux-bg0: #{ctp.$base};
--modernflux-bg1: #{ctp.$surface0};
--modernflux-bg2: #{ctp.$surface1};
--modernflux-accent: #{ctp.$${accent}};
--modernflux-success: #{ctp.$green};
--modernflux-danger: #{ctp.$red};
--modernflux-danger-semi: #{transparentize(ctp.$red, 0.8)};
}
`.trimStart();
const flexokiTemplate = ({ variant, accent }: { variant: string; accent: string }) =>
`
@use "../../themes/flexoki/${variant}" as flexoki;
:root {
--modernflux-color-scheme: #{flexoki.$color-scheme};
--modernflux-fg0: #{flexoki.$tx};
--modernflux-fg1: #{flexoki.$tx-2};
--modernflux-fg2: #{flexoki.$tx-3};
--modernflux-bg0: #{flexoki.$bg};
--modernflux-bg1: #{flexoki.$bg-2};
--modernflux-bg2: #{flexoki.$ui};
--modernflux-accent: #{flexoki.$${accent}};
--modernflux-success: #{flexoki.$green};
--modernflux-danger: #{flexoki.$red};
--modernflux-danger-semi: #{transparentize(flexoki.$red, 0.8)};
}
`.trimStart();
for (const flavor of ctpFlavors) {
for (const accent of ctpAccents) {
const path = `src/catppuccin/${flavor}/${accent}.scss`;
await mkdir(dirname(path), { recursive: true });
await writeFile(path, ctpTemplate({ flavor, accent }));
}
}
for (const variant of flexokiVariants) {
for (const accent of flexokiAccents) {
const path = `src/flexoki/${variant}/${accent}.scss`;
await mkdir(dirname(path), { recursive: true });
await writeFile(path, flexokiTemplate({ variant, accent }));
}
}