![](/img/trans.png)
[英]Custom tailwind colors from tailwind.config.js not generated
[英]Get custom colors defined on tailwind config file in js (`colors` object)
我在 tailwind.config.js 文件中定义了一些自定义的 colors。
module.exports = {
darkMode: 'class',
content: [
'./src/**/*.{js,jsx,ts,tsx,html}',
'./public/index.html'
],
theme: {
extend: {
colors: {
primary: '#E3106E',
gp: '#19AAF8',
bl: '#F56622',
airtel: '#EC1C24',
robi: '#E30B13',
teletalk: '#6EB344'
}
},
plugins: []
},
gpColor: '#19AAF8'
}
在js文件中,我可以从tailwind CSS导入的colors
变量中得到tailwind colors。有没有办法在js文件中得到自定义的colors?
您可以将其应用为
import colors from 'tailwindcss/path'
const green = colors.primary;
这可能对你有帮助。
供参考:- 第二件事是,如果您使用的是 tailwind CSS,那么您可以直接在您的代码上使用他们自己的 CSS colors。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.