-
Notifications
You must be signed in to change notification settings - Fork 416
/
uno.config.ts
49 lines (48 loc) · 1.46 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
import { defineConfig, presetIcons, presetUno, transformerDirectives, transformerVariantGroup } from "unocss"
import { hex2rgba } from "@unocss/rule-utils"
import { sources } from "./shared/sources"
export default defineConfig({
mergeSelectors: false,
transformers: [transformerDirectives(), transformerVariantGroup()],
presets: [
presetUno(),
presetIcons({
scale: 1.2,
}),
],
rules: [
[/^sprinkle-(.+)$/, ([_, d], { theme }) => {
// @ts-expect-error >_<
const hex: any = theme.colors?.[d]?.[400]
if (hex) {
return {
"background-image": `radial-gradient(ellipse 80% 80% at 50% -30%,
rgba(${hex2rgba(hex)?.join(", ")}, 0.3), rgba(255, 255, 255, 0));`,
}
}
}],
[
"font-brand",
{
"font-family": `"Baloo 2", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
"Liberation Mono", "Courier New", monospace; `,
},
],
],
shortcuts: {
"color-base": "color-neutral-800 dark:color-neutral-300",
"bg-base": "bg-zinc-50 dark:bg-dark-600",
"btn": "op50 hover:op85",
},
safelist: [
...["orange", ...new Set(Object.values(sources).map(k => k.color))].map(k =>
`bg-${k} color-${k} border-${k} sprinkle-${k} shadow-${k}
bg-${k}-500 color-${k}-500
dark:bg-${k} dark:color-${k}`.trim().split(/\s+/)).flat(),
],
extendTheme: (theme) => {
// @ts-expect-error >_<
theme.colors.primary = theme.colors.red
return theme
},
})