-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtailwind.config.js
217 lines (183 loc) · 5.82 KB
/
tailwind.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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
/*
genre.guide - Tailwind configuration file
Copyright (C) 2020 Navith
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/*
Tailwind - The Utility-First CSS Framework
A project by Adam Wathan (@adamwathan), Jonathan Reinink (@reinink),
David Hemphill (@davidhemphill) and Steve Schoger (@steveschoger).
View the full documentation at https://tailwindcss.com.
*/
const { lch } = require("d3-color");
const defaultConfig = require("tailwindcss/defaultConfig");
const newTailwindColorsConfig = require("tailwindcss/lib/flagged/uniformColorPalette").default;
const tailwindcssCustomNative = require("tailwindcss-custom-native");
const tailwindcssGradients = require("tailwindcss-gradients");
const tailwindcssLeadingTrim = require("tailwindcss-leading-trim");
const {
tailwindcssThemeVariants,
focus, hover, prefersDark, prefersLight, groupHover, groupFocus, selection,
} = require("tailwindcss-theme-variants");
const colors = require("./src/node_modules/design-system/colors");
const newTailwindColors = newTailwindColorsConfig.theme.colors;
const { theme: defaultTheme, variants: defaultVariants } = defaultConfig;
const [_, l, c, h] = colors.green[400].match(/lch\(([.\d]+) ([.\d]+) ([.\d]+)\)/);
// eslint-disable-next-line camelcase
const green_400_70 = lch(l, c, h, 0.70);
// eslint-disable-next-line camelcase
const black_70 = lch(0, 0, 0, 0.70);
// eslint-disable-next-line camelcase
const white_70 = lch(100, 0, 0, 0.70);
// eslint-disable-next-line camelcase
const shadowOutlineGreen = `0 0 0 3px ${green_400_70}`;
// eslint-disable-next-line camelcase
const shadowOutlineBlack = `0 0 0 3px ${black_70}`;
// eslint-disable-next-line camelcase
const shadowOutlineWhite = `0 0 0 3px ${white_70}`;
/** @type{import("@navith/tailwindcss-plugin-author-types").TailwindCSSConfig} */
const tailwindcssConfig = {
theme: {
colors: {
transparent: "transparent",
current: "currentColor",
inherit: "inherit",
black: newTailwindColors.black,
white: newTailwindColors.white,
gray: newTailwindColors.gray,
...colors,
},
borderColor: {
transparent: "transparent",
current: "currentColor",
gray: newTailwindColors.gray,
},
extend: {
borderSpacing: { 4: "1rem" },
boxShadow: {
outline: shadowOutlineGreen,
"outline-black": shadowOutlineBlack,
"outline-white": shadowOutlineWhite,
"outline-with-lg": `${defaultTheme.boxShadow.lg}, ${shadowOutlineGreen}`,
"white-glow": `0 0 8px 4px ${newTailwindColors.white}`,
"gray-900-glow": `0 0 8px 4px ${newTailwindColors.gray[900]}`,
},
customUtilities: {
borderSpacing: {},
},
fontSize: {
"7xl": "5rem",
"8xl": "6rem",
"9xl": "7rem",
},
minWidth: (theme_) => theme_("spacing"),
spacing: {
7: "1.75rem",
9: "2.25rem",
72: "18rem",
96: "24rem",
128: "32rem",
},
},
fontFamily: {
heading: ["Inter", ...defaultTheme.fontFamily.sans],
body: ["Inter", ...defaultTheme.fontFamily.sans],
},
linearGradientColors: {
day: ["lch(91 32.612 203.866)", "lch(68 50.636 276.408)"],
night: ["lch(47 65.876 282)", "lch(40 70.572 290)", "lch(30 80 300)"],
},
radialGradientColors: {
sun: ["lch(95 90.845 93.996)", "lch(93 98.845 85.996)"],
moon: ["lch(87 0.702 18.519)", "lch(75 0.872 236.434)"],
},
},
corePlugins: {
backgroundOpacity: false,
borderOpacity: false,
divideColor: false,
divideOpacity: false,
divideWidth: false,
placeholderColor: false,
placeholderOpacity: false,
skew: false,
textOpacity: false,
transformOrigin: false,
transitionDelay: false,
},
variants: {
backgroundColor: [
...defaultVariants.backgroundColor,
"themes",
"themes:hover",
"themes:focus",
"themes:selection",
"selection:important",
],
borderColor: [...defaultVariants.borderColor, "group-hover", "group-focus"],
boxShadow: [...defaultVariants.boxShadow, "themes", "themes:focus"],
textColor: [
...defaultVariants.textColor,
"themes",
"themes:hover",
"themes:focus",
"themes:group-focus",
"themes:group-hover",
"themes:selection",
"selection:important",
],
},
plugins: [
tailwindcssCustomNative,
tailwindcssGradients,
tailwindcssLeadingTrim,
tailwindcssThemeVariants({
group: "themes",
baseSelector: "html",
fallback: "light-theme",
themes: {
"light-theme": { selector: "[data-theme=light]", mediaQuery: prefersLight },
"dark-theme": { selector: "[data-theme=dark]", mediaQuery: prefersDark },
},
variants: {
focus,
"group-focus": groupFocus,
"group-hover": groupHover,
hover,
selection,
},
}),
({ addVariant, e }) => {
// Add important selection variant
addVariant("selection:important", ({ container, modifySelectors, separator }) => {
container.walkRules((rule) => {
rule.walkDecls((decl) => {
// eslint-disable-next-line no-param-reassign
decl.important = true;
});
});
modifySelectors(({ className }) => {
const selectionClassName = e(`selection${separator}!${className}`);
return `.${selectionClassName}::selection, .${selectionClassName} ::selection`;
});
});
},
],
experimental: {
applyComplexClasses: true,
},
future: {
removeDeprecatedGapUtilities: true,
},
purge: false,
};
module.exports = tailwindcssConfig;