-
Notifications
You must be signed in to change notification settings - Fork 0
/
uno.config.ts
54 lines (48 loc) · 1.1 KB
/
uno.config.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
/**
* @file UnoCSS config
* @see https://unocss.dev/guide/config-file
*/
import presetWind from "@unocss/preset-wind";
import transformDirectives from "@unocss/transformer-directives";
import {Colord, extend} from "colord";
import mixPlugin from "colord/plugins/mix";
import {defineConfig} from "unocss";
// Extend Colord
extend([mixPlugin]);
/**
* Primary color
*/
const primary = new Colord("#51c5db");
/**
* Secondary color
*/
const secondary = new Colord("#f69876");
/**
* Generate tones of a color
* @param color Color to generate tones for
* @returns Tones
*/
const generateTones = (color: Colord) =>
Object.fromEntries(
[
...color.tints(22).reverse(),
...color.shades(22).slice(1),
]
.map((tone, index) => [25 * index, tone.toHex()])
.filter((_, index) => index === 1 || index % 2 === 0)
.slice(1, -1),
);
export default defineConfig({
presets: [
presetWind({
dark: "class",
}),
],
transformers: [transformDirectives()],
theme: {
colors: {
primary: generateTones(primary),
secondary: generateTones(secondary),
},
},
});