-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.config.ts
65 lines (61 loc) · 1.7 KB
/
tailwind.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
import { bicolor } from "tailwind-bicolor";
import { type Config } from "tailwindcss";
import colors, { modifierPairMap } from "./src/tokens/colors";
import spacings from "./src/tokens/spacings";
import fontSize from "./src/tokens/typography";
const variants = ["sm", "md", "lg", "xl"];
const config: Config = {
content: [
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
"./src/preview/**/*.{js,ts,jsx,tsx,mdx}",
],
safelist: [
{ pattern: /grid-cols-/, variants },
{ pattern: /col-span-/, variants },
{
pattern: /w-(1\/12|2\/12|3\/12|4\/12|5\/12|6\/12|7\/12|8\/12|9\/12|10\/12|11\/12|12\/12)/,
variants,
},
],
theme: {
...spacings,
fontSize,
colors,
extend: {
width: {
"12/12": "100%",
},
},
fontFamily: {
sans: ["var(--inter)"],
mono: ["var(--font-geist-mono)"],
},
},
darkMode: "class",
plugins: [
bicolor({
variantName: "theme",
getColor({ classColor, theme }) {
if (classColor.shade && classColor.shade in modifierPairMap) {
return theme(
`colors.${classColor.color}.${
modifierPairMap[Number(classColor.shade) as keyof typeof modifierPairMap]
}`,
);
}
if (classColor.color && classColor.color.includes("-")) {
return theme(
`colors.${classColor.color.split("-")[0]}.${
classColor.color.split("-")[1] === "dark" ? "light" : "dark"
}`,
);
}
// return same color
return theme(`colors.${classColor.color}`);
},
}),
],
};
export default config;