-
Notifications
You must be signed in to change notification settings - Fork 5
/
tailwind.config.cjs
63 lines (60 loc) · 1.69 KB
/
tailwind.config.cjs
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
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
theme: {
extend: {
colors: {
surface: 'var(--p-color-bg-surface)',
'surface-hovered': 'var(--p-color-bg-surface-hover)',
'surface-subdued': 'var(--p-color-bg-surface-disabled)',
},
fontFamily: {
mono: ['var(--p-font-family-mono)'],
},
borderRadius: {
'p200': 'var(--p-border-radius-200)'
},
borderColor: {
'brand': 'var(--p-color-border-brand)',
},
typography: theme => ({
DEFAULT: {
css: {
'--tw-prose-pre-bg': 'transparent',
'--tw-prose-pre-code': theme('colors.slate.700'),
// color: '#333',
code: {
color: theme('colors.slate.700'),
'&:hover': {
backgroundColor: theme('colors.slate.50'),
},
},
},
},
}),
},
},
corePlugins: {
preflight: false,
},
plugins: [
// Add colors as CSS variables.
// Example :`var(--color-teal-500)`
function ({ addBase, theme }) {
function extractColorVars(colorObj, colorGroup = '') {
return Object.keys(colorObj).reduce((vars, colorKey) => {
const value = colorObj[colorKey]
const newVars =
typeof value === 'string'
? { [`--color${colorGroup}-${colorKey}`]: value }
: extractColorVars(value, `-${colorKey}`)
return { ...vars, ...newVars }
}, {})
}
addBase({
':root': extractColorVars(theme('colors')),
})
},
require('@tailwindcss/typography'),
],
}