-
-
Notifications
You must be signed in to change notification settings - Fork 173
/
tailwind.config.cjs
137 lines (116 loc) · 3.18 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
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
const defaultColors = require('tailwindcss/colors')
const path = require('pathe')
const inheritedConfig = require('../../tailwind.config.cjs')
// Colors
function withOpacityValue(variable) {
return ({ opacityValue }) => {
if (opacityValue === undefined) {
return `rgb(var(${variable}))`
}
return `rgb(var(${variable}) / ${opacityValue})`
}
}
const colorKeys = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900]
const grayKeys = [...colorKeys, 750, 850, 950]
const themedColors = ['primary', 'gray'].reduce((acc, color) => {
const keys = (color === 'gray' ? grayKeys : colorKeys)
for (const key of keys) {
acc[`${color}-${key}`] = withOpacityValue(`--_histoire-color-${color}-${key}`)
}
return acc
}, {})
const excludedDefaultColors = [
// Grays
'slate',
'gray',
'zinc',
'neutral',
'stone',
// Deprecated colors
'lightBlue',
'warmGray',
'trueGray',
'coolGray',
'blueGray',
]
const includedDefaultColors = {}
for (const key in defaultColors) {
if (!excludedDefaultColors.includes(key)) {
includedDefaultColors[key] = defaultColors[key]
}
}
const colors = {
...includedDefaultColors,
white: '#fff',
black: '#000',
transparent: 'transparent',
...themedColors,
}
module.exports = {
...inheritedConfig,
prefix: 'htw-',
content: [
path.resolve(__dirname, './src/**/*.{vue,js,ts,jsx,tsx,md}'),
// Include controls CSS directly
path.resolve(__dirname, '../histoire-controls/src/**/*.{vue,js,ts,jsx,tsx,md}'),
],
corePlugins: {
preflight: false,
},
}
delete module.exports.theme.extend.colors.primary
delete module.exports.theme.extend.colors.gray
module.exports.theme.colors = colors
module.exports.plugins.push(require('@tailwindcss/typography'))
// prose-a:htw-text-primary-500 prose-headings:htw-mb-2 prose-headings:htw-mt-4 first:prose-headings:htw-mt-0 prose-blockquote:htw-ml-0
module.exports.theme.extend.typography = theme => ({
DEFAULT: {
css: {
'a': {
'color': theme('colors.primary-500'),
'textDecoration': 'none',
'&:hover': {
textDecoration: 'underline',
},
},
'h1, h2, h3, h4, th': {
'marginBottom': '0.75rem',
'&:not(:first-child)': {
marginTop: '1.25rem',
},
},
'--tw-prose-invert-quote-borders': theme('colors.gray-800'),
'--tw-prose-invert-hr': theme('colors.gray-800'),
'blockquote': {
'marginLeft': 0,
'marginRight': 0,
'backgroundColor': theme('colors.gray-100'),
'padding': '.25rem .375rem',
'& p:first-child': {
marginTop: 0,
},
'& p:last-child': {
marginBottom: 0,
},
'.dark &': {
backgroundColor: theme('colors.gray-750'),
},
},
'--tw-prose-invert-bullets': theme('colors.gray-500'),
'li': {
marginTop: '0.1rem',
marginBottom: '0.1rem',
},
'code': {
'backgroundColor': theme('colors.gray-500 / 20%'),
'fontWeight': 'normal',
'padding': '0.05rem 0.5rem',
'borderRadius': '0.25rem',
'fontSize': '0.8rem',
'&::before, &::after': {
display: 'none',
},
},
},
},
})