如何为默认方案添加颜色?这是我的tailwindcss文件。
const { colors: defaultColors } = require('tailwindcss/defaultTheme')
module.exports = {
"theme": {
"colors": defaultColors + {
"custom-yellow": {
"500": "#EDAE0A",
}
},
},
};
答案 0 :(得分:2)
将自定义颜色值添加到主题>扩展> tailwind.config.js中的颜色部分
//tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
'custom-yellow':'#BAA333',
}
},
},
}
答案 1 :(得分:0)
您可以简单地使用“数组/对象扩展运算符”(...)对其进行概括,并将它们全部收集在colors
变量中。
// tailwind.config.js
const { colors: defaultColors } = require('tailwindcss/defaultTheme')
const colors = {
...defaultColors,
...{
"custom-yellow": {
"500": "#EDAE0A",
},
},
}
module.exports = {
"theme": {
"colors": colors,
}
};
答案 2 :(得分:0)
试试这个代码然后重启localhost
`module.exports = {
purge: ['./src/**/*.{js,jsx,ts,tsx}', './public/index.html'],
darkMode: false, // or 'media' or 'class'
theme: {
extend:
{colors:
{
pinkSoft: '#EDC7B7',
wheat: '#EEE2DC',
gray: '#BAB2B5',
blue: '#BADFE7',
blue2: '#697184',
pink: '#D8CFD0',
bg: '#B1A6A4',
bgDark: '#413F3D',
},},
},
variants: {
extend: {},
},
plugins: [],
}`