-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuno.config.ts
83 lines (82 loc) · 2.14 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
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
// uno.config.ts
import {defineConfig, presetUno, transformerVariantGroup} from "unocss";
import transformerDirectives from "@unocss/transformer-directives";
export default defineConfig({
theme: {
fontFamily: {
sans: "Montserrat",
},
colors: {
surface: "hsl(var(--clrSurface))",
base: "hsl(var(--clrBase))",
primary: "hsl(var(--clrPrimary))",
secondary: "hsl(var(--clrSecondary))",
tertiary: "hsl(var(--clrTertiary))",
},
},
presets: [presetUno()],
transformers: [transformerVariantGroup(), transformerDirectives({})],
rules: [
[
/^grid-col-fill-(\d+)$/,
([, d]) => ({
"grid-template-columns": `repeat( auto-fit, minmax(${d}px, 1fr) );`,
}),
],
[
/^scrollbar-hide$/,
([_]) => {
return `.scrollbar-hide{scrollbar-width:none}
.scrollbar-hide::-webkit-scrollbar{display:none}`;
},
],
[
/^scrollbar-default$/,
([_]) => {
return `.scrollbar-default{scrollbar-width:auto}
.scrollbar-default::-webkit-scrollbar{display:block}`;
},
],
[
// https://unocss.dev/config/theme#usage-in-rules
/^text-(.*)$/,
// @ts-ignore
([, c], {theme}) => {
if (theme.colors && theme.colors[c]) return {color: theme.colors[c]};
},
],
// [
// /^fill-(.*)$/,
// // @ts-ignore
// ([, c], {theme}) => {
// if (theme.colors && theme.colors[c]) return {fill: theme.colors[c]};
// },
// ],
// [
// /^stroke-(.*)$/,
// // @ts-ignore
// ([, c], {theme}) => {
// if (theme.colors && theme.colors[c]) return {stroke: theme.colors[c]};
// },
// ],
[
// https://unocss.dev/config/theme#usage-in-rules
/^bglg-(.*(?=\)$))/,
([, c]) => {
return {
"background-image": `linear-gradient(${c.replaceAll("_", " ")})`,
};
},
],
[
// https://unocss.dev/config/theme#usage-in-rules
/^bg-(.*)$/,
// @ts-ignore
([, c], {theme}) => {
if (theme.colors && theme.colors[c]) {
return {"background-color": theme.colors[c]};
}
},
],
],
});