-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.config.js
73 lines (70 loc) · 1.66 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
// @ts-check
const plugin = require('tailwindcss/plugin');
const withAlphaVariable =
require('tailwindcss/lib/util/withAlphaVariable').default;
const flattenColorPalette =
require('tailwindcss/lib/util/flattenColorPalette').default;
/** @param {number} num */
const round = (num) =>
num
.toFixed(7)
.replace(/(\.[0-9]+?)0+$/, '$1')
.replace(/\.0$/, '');
/** @param {number} px */
const em = (px, base = 16) => `${round(px / base)}em`;
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
'./helpers/**/*.{js,ts,jsx,tsx}',
],
theme: {
screens: {
/* Tailwind defaults, but in `em` (see https://danburzo.ro/media-query-units/) */
sm: em(640),
md: em(768),
lg: em(1024),
xl: em(1280),
'2xl': em(1536),
},
extend: {
container: {
center: true,
padding: '1rem',
},
},
},
darkMode: [
'variant',
[
'@media (prefers-color-scheme: dark) { &:not(:root[data-theme="light"] *) }',
'&:is(:root[data-theme="dark"] *)',
],
],
variants: {
extend: {},
},
plugins: [
plugin(({ matchUtilities, theme }) => {
matchUtilities(
{
'text-fill': (value) => {
return withAlphaVariable({
color: value,
property: '-webkit-text-fill-color',
variable: '--tw-text-opacity',
});
},
},
{
values: flattenColorPalette(theme('textColor')),
type: ['color', 'any'],
},
);
}),
],
future: {
hoverOnlyWhenSupported: true,
},
};