forked from cerinoligutom/Vue3-Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.config.js
61 lines (56 loc) · 1.7 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
/**
*
* @param {string} variableName The CSS variable name.
*/
function withOpacity(variableName) {
return ({ opacityValue }) => {
return opacityValue ? `rgba(var(${variableName}), ${opacityValue})` : `rgb(var(${variableName}))`;
};
}
/**
* @param {string} colorName The CSS variable color name.
* @param {Object} opts
* @param {boolean} opts.light Include light colors.
* @param {boolean} opts.dark Include dark colors.
*/
function useColor(colorName, { light = true, dark = true } = {}) {
const colorVariants = {
[colorName]: withOpacity(`--color-${colorName}`),
[`on-${colorName}`]: withOpacity(`--color-on-${colorName}`),
};
const lightVariants = {
[`${colorName}-light`]: withOpacity(`--color-${colorName}-light`),
[`on-${colorName}-light`]: withOpacity(`--color-on-${colorName}-light`),
};
const darkVariants = {
[`${colorName}-dark`]: withOpacity(`--color-${colorName}-dark`),
[`on-${colorName}-dark`]: withOpacity(`--color-on-${colorName}-dark`),
};
return {
...colorVariants,
...(light ? lightVariants : {}),
...(dark ? darkVariants : {}),
};
}
module.exports = {
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
theme: {
extend: {
colors: {
...useColor('brand-main'),
...useColor('brand-accent'),
...useColor('surface', { light: false, dark: false }),
...useColor('background', { light: false, dark: false }),
},
spacing: {
spacer: '1rem',
},
},
},
plugins: [
// https://github.com/tailwindlabs/tailwindcss-aspect-ratio
require('@tailwindcss/aspect-ratio'),
// https://github.com/tailwindlabs/tailwindcss-forms
require('@tailwindcss/forms'),
],
};