-
Notifications
You must be signed in to change notification settings - Fork 4
/
tailwind.config.js
262 lines (255 loc) · 7.78 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
const defaultTheme = require('tailwindcss/defaultTheme')
const colors = require('tailwindcss/colors')
const { default: flattenColorPalette } = require('tailwindcss/lib/util/flattenColorPalette')
const { toRgba } = require('tailwindcss/lib/util/withAlphaVariable')
module.exports = {
purge: ['./src/**/*.{js,mdx}'],
darkMode: 'class',
theme: {
colors: {
transparent: 'transparent',
current: 'currentColor',
black: '#000',
white: '#fff',
amber: colors.amber,
blue: colors.blue,
cyan: colors.cyan,
emerald: colors.emerald,
fuchsia: colors.fuchsia,
gray: colors.coolGray,
green: colors.green,
indigo: colors.indigo,
'light-blue': colors.lightBlue,
lime: colors.lime,
orange: {
...colors.orange,
1000: '#4a2008',
},
pink: {
...colors.pink,
1000: '#460d25',
},
purple: colors.purple,
red: colors.red,
rose: colors.rose,
teal: colors.teal,
violet: colors.violet,
yellow: colors.yellow,
code: {
punctuation: '#A1E8FF',
tag: '#D58FFF',
'attr-name': '#4BD0FB',
'attr-value': '#A2F679',
string: '#A2F679',
highlight: 'rgba(134, 239, 172, 0.25)',
},
},
extend: {
typography: (theme) => ({
DEFAULT: {
css: {
maxWidth: 'none',
color: theme('colors.gray.500'),
'> :first-child': { marginTop: '-' },
'> :last-child': { marginBottom: '-' },
'&:first-child > :first-child': {
marginTop: '0',
},
'&:last-child > :last-child': {
marginBottom: '0',
},
'h1, h2': {
letterSpacing: '-0.025em',
},
'h2, h3': {
'scroll-margin-block': `${(70 + 40) / 16}rem`,
},
'ul > li': {
paddingLeft: '1.5em',
},
'ul > li::before': {
width: '0.75em',
height: '0.125em',
top: 'calc(0.875em - 0.0625em)',
left: 0,
borderRadius: 0,
backgroundColor: theme('colors.gray.300'),
},
a: {
color: theme('colors.cyan.700'),
fontWeight: theme('fontWeight.medium'),
textDecoration: 'none',
boxShadow: theme('boxShadow.link'),
},
'a code': {
color: 'inherit',
fontWeight: 'inherit',
},
strong: {
color: theme('colors.gray.900'),
fontWeight: theme('fontWeight.medium'),
},
'a strong': {
color: 'inherit',
fontWeight: 'inherit',
},
code: {
fontWeight: '400',
color: theme('colors.violet.600'),
},
'code::before': {
// content: 'none',
},
'code::after': {
// content: 'none',
},
pre: {
backgroundColor: '-',
color: theme('colors.white'),
borderRadius: 0,
marginTop: 0,
marginBottom: 0,
},
table: {
fontSize: theme('fontSize.sm')[0],
lineHeight: theme('fontSize.sm')[1].lineHeight,
},
thead: {
color: theme('colors.gray.600'),
borderBottomColor: theme('colors.gray.200'),
},
'thead th': {
paddingTop: 0,
fontWeight: theme('fontWeight.semibold'),
},
'tbody tr': {
borderBottomColor: theme('colors.gray.200'),
},
'tbody tr:last-child': {
borderBottomWidth: '1px',
},
'tbody code': {
fontSize: theme('fontSize.xs')[0],
},
},
},
}),
fontFamily: {
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
mono: ['Menlo', ...defaultTheme.fontFamily.mono],
source: ['Source Sans Pro', ...defaultTheme.fontFamily.sans],
'ubuntu-mono': ['Ubuntu Mono', ...defaultTheme.fontFamily.mono],
system: defaultTheme.fontFamily.sans,
flow: 'Flow',
},
spacing: {
18: '4.5rem',
88: '22rem',
'15px': '0.9375rem',
'23px': '1.4375rem',
full: '100%',
},
width: {
xl: '36rem',
},
maxWidth: {
'4.5xl': '60rem',
'8xl': '90rem',
},
maxHeight: (theme) => ({
sm: '30rem',
'(screen-18)': `calc(100vh - ${theme('spacing.18')})`,
}),
boxShadow: {
px: '0 0 0 1px rgba(0, 0, 0, 0.5)',
link: 'inset 0 -0.125em 0 0 #fff, inset 0 -0.375em 0 0 rgba(165, 243, 252, 0.4)',
},
keyframes: {
'flash-code': {
'0%': { backgroundColor: 'rgba(134, 239, 172, 0.25)' },
'100%': { backgroundColor: 'transparent' },
},
},
animation: {
'flash-code': 'flash-code 1s forwards',
'flash-code-slow': 'flash-code 2s forwards',
},
cursor: {
grab: 'grab',
grabbing: 'grabbing',
},
transitionDuration: {
1500: '1.5s',
},
backgroundImage: {
squiggle: `url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%206%203'%20enable-background%3D'new%200%200%206%203'%20height%3D'3'%20width%3D'6'%3E%3Cg%20fill%3D'%23fbbf24'%3E%3Cpolygon%20points%3D'5.5%2C0%202.5%2C3%201.1%2C3%204.1%2C0'%2F%3E%3Cpolygon%20points%3D'4%2C0%206%2C2%206%2C0.6%205.4%2C0'%2F%3E%3Cpolygon%20points%3D'0%2C2%201%2C3%202.4%2C3%200%2C0.6'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E")`,
},
scale: {
80: '0.8',
},
skew: {
'-20': '-20deg',
},
},
},
variants: {
extend: {
backgroundColor: ['odd', 'even', 'active'],
borderWidth: ['first', 'last', 'hover', 'focus'],
cursor: ['active'],
opacity: ['disabled'],
textColor: ['group-focus'],
ringWidth: ['focus-visible'],
ringOffsetWidth: ['focus-visible'],
ringOffsetColor: ['focus-visible'],
ringColor: ['focus-visible'],
ringOpacity: ['focus-visible'],
rotate: ['first', 'last', 'odd', 'even'],
},
},
plugins: [
require('@tailwindcss/typography'),
function ({ addUtilities, theme }) {
const shadows = theme('boxShadow')
addUtilities(
Object.keys(shadows).reduce(
(utils, key) => ({
...utils,
[`.text-shadow${key === 'DEFAULT' ? '' : `-${key}`}`]: {
textShadow: shadows[key].replace(
/([0-9]+(px)? [0-9]+(px)? [0-9]+(px)?) [0-9]+(px)?/g,
'$1'
),
},
}),
{}
)
)
},
function ({ addUtilities, theme }) {
const utilities = {
'.bg-stripes': {
backgroundImage:
'linear-gradient(45deg, var(--stripes-color) 12.50%, transparent 12.50%, transparent 50%, var(--stripes-color) 50%, var(--stripes-color) 62.50%, transparent 62.50%, transparent 100%)',
backgroundSize: '5.66px 5.66px',
},
}
const addColor = (name, color) =>
(utilities[`.bg-stripes-${name}`] = { '--stripes-color': color })
const colors = flattenColorPalette(theme('backgroundColor'))
for (let name in colors) {
try {
const [r, g, b, a] = toRgba(colors[name])
if (a !== undefined) {
addColor(name, colors[name])
} else {
addColor(name, `rgba(${r}, ${g}, ${b}, 0.4)`)
}
} catch (_) {
addColor(name, colors[name])
}
}
addUtilities(utilities)
},
],
}