-
Notifications
You must be signed in to change notification settings - Fork 183
Expand file tree
/
Copy pathtailwind.config.ts
More file actions
103 lines (96 loc) · 3.01 KB
/
Copy pathtailwind.config.ts
File metadata and controls
103 lines (96 loc) · 3.01 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
import type { Config } from "tailwindcss";
import {
TailwindColorSpacing,
TailwindColors,
} from "./src/features/themes/color-config";
function generateTailwindVariables() {
const colors: Record<string, Record<string, string>> = {};
TailwindColors.forEach((color) => {
colors[color] = genColorObject(color);
});
return colors;
}
function genColorObject(color: string) {
return Object.fromEntries(
TailwindColorSpacing.map((colorNum) => {
return [`${colorNum}`, oklabString(`color-${color}-${colorNum}`)];
}),
);
}
function oklabString(variableName: string) {
return `color-mix(in oklab, var(--${variableName}) calc(<alpha-value> * 100%), transparent)`;
}
export default {
// need to add this for storybook
// https://www.kantega.no/blogg/setting-up-storybook-7-with-vite-and-tailwind-css
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx,svelte}"],
/** Once we have applied dark styling to all UI elements, remove this line */
darkMode: "class",
theme: {
extend: {
borderColor: {
DEFAULT: oklabString("border"),
},
colors: {
background: oklabString("background"),
foreground: oklabString("foreground"),
card: {
DEFAULT: oklabString("card"),
foreground: oklabString("card-foreground"),
},
popover: {
DEFAULT: oklabString("popover"),
foreground: oklabString("popover-foreground"),
},
primary: {
DEFAULT: oklabString("color-primary-500"),
foreground: oklabString("color-gray-50"),
...genColorObject("primary"),
},
secondary: {
DEFAULT: oklabString("color-secondary-500"),
foreground: oklabString("color-gray-50"),
...genColorObject("secondary"),
},
muted: {
DEFAULT: oklabString("muted"),
foreground: oklabString("muted-foreground"),
},
accent: {
DEFAULT: oklabString("accent"),
foreground: oklabString("accent-foreground"),
},
destructive: {
DEFAULT: oklabString("destructive"),
foreground: oklabString("destructive-foreground"),
},
border: oklabString("border"),
input: oklabString("input"),
ring: oklabString("ring"),
surface: oklabString("surface"),
theme: {
DEFAULT: oklabString("color-theme-500"),
foreground: oklabString("theme-foreground"),
...genColorObject("theme"),
},
"theme-secondary": {
DEFAULT: oklabString("color-theme-secondary-500"),
foreground: oklabString("color-gray-50"),
...genColorObject("theme-secondary"),
},
...generateTailwindVariables(),
},
borderRadius: {
lg: "var(--radius)",
md: "calc(var(--radius) - 2px)",
sm: "calc(var(--radius) - 4px)",
},
zIndex: {
popover: "80",
},
},
},
safelist: [
"ui-copy-code", // needed for code in measure expressions
],
} satisfies Config;