-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuno.config.ts
82 lines (79 loc) · 2.23 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
// uno.config.ts
import { colors } from "@unocss/preset-wind"
import { defineConfig, presetUno } from "unocss"
export default defineConfig({
presets: [presetUno()],
content: {
// needed for uno css to properly parse the content
pipeline: {
include: [
// the default
/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/,
// include js/ts files
"src/**/*.{js,ts}",
],
},
},
theme: {
colors: {
transparent: "transparent",
current: "currentColor",
black: "#000",
white: "#fff",
dark: colors.slate[950], // '#020617'
darkLight: colors.slate[900],
darkLightBorder: colors.slate[800],
grayDark: colors.slate[600],
gray: colors.slate[400],
grayLight: colors.slate[300],
light: colors.slate[200],
primary: colors.sky[600],
success: "#27C485",
warning: "#F1B650",
error: colors.red[500],
},
fontSize: {
base: ["13.5px", "24px"],
small: ["12px", "20px"],
micro: ["10px", "12px"],
},
fontFamily: {
sans: "Helvetica Neue, Arial, Tahoma, sans-serif",
},
},
preflights: [
{
// to get use of the theme colors as css variables
getCSS: ({ theme }) => {
let cssVariables = ""
if (theme.colors) {
// eslint-disable-next-line no-restricted-syntax
for (const color of Object.keys(theme.colors)) {
if (typeof theme.colors?.[color] === "string") {
cssVariables += `--color-${color}: ${theme.colors?.[color]};\n`
}
}
}
if (theme.fontSize) {
// eslint-disable-next-line no-restricted-syntax
for (const size of Object.keys(theme.fontSize)) {
if (Array.isArray(theme.fontSize?.[size])) {
cssVariables += `--font-size-${size}: ${theme.fontSize?.[size][0]};\n`
}
}
}
return `
body, html {
background-color: ${theme.colors?.dark};
color: ${theme.colors?.light};
font-family: ${theme.fontFamily?.sans};
font-size: ${theme.fontSize?.base[0]};
}
:root {
${cssVariables}
}
`
},
},
],
})