-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtailwind-radix-semantic.config.js
73 lines (64 loc) · 2.2 KB
/
tailwind-radix-semantic.config.js
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
const radixColors = require("@radix-ui/colors");
const { fontFamily } = require("tailwindcss/defaultTheme");
const tailwindThemePlugin = require("tailwindcss-variable-themes");
/**
* colors partially picked from https://vercel.com/design/color
*/
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./app/radix-semantic/*.tsx", "./components/**/*.tsx"],
theme: {
extend: {
fontFamily: {
sans: ["var(--font-inter)", ...fontFamily.sans],
},
},
},
plugins: [
tailwindThemePlugin({
// colors guide from Radix-UI
// https://www.radix-ui.com/docs/colors/palette-composition/understanding-the-scale
varNameMapper: (_, i) =>
[
"app-bg", // 1 - App background
"subtle-bg", // 2 - Subtle background
"ui", // 3 - UI element background
"ui-hover", // 4 - Hovered UI element background
"ui-active", // 5 - Active / Selected UI element background
"border-subtle", // 6 - Subtle borders and separators
"border", // 7 - UI element border and focus rings
"border-hover", // 8 - Hovered UI element border
"solid", // 9 - Solid backgrounds
"solid-hover", // 10 - Hovered solid backgrounds
"foreground-secondary", // 11 - Low-contrast text
"foreground-primary", // 12 - High-contrast text
][i],
themes: {
"gray-light": {
primary: radixColors.gray,
accent: radixColors.red,
},
"gray-dark": {
primary: radixColors.grayDark,
accent: radixColors.redDark,
},
"amber-light": {
primary: radixColors.amber,
accent: radixColors.red,
},
"amber-dark": {
primary: radixColors.amberDark,
accent: radixColors.redDark,
},
"green-light": {
primary: radixColors.green,
accent: radixColors.yellow,
},
"green-dark": {
primary: radixColors.greenDark,
accent: radixColors.yellowDark,
},
},
}),
],
};