Add multiple theme colors

This commit is contained in:
Sat Naing
2022-09-08 22:40:45 +06:30
parent 147d934e97
commit 02d29f0914
2 changed files with 46 additions and 6 deletions
+29 -6
View File
@@ -1,8 +1,31 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
theme: {
extend: {},
},
plugins: [],
function withOpacity(variableName) {
return ({ opacityValue }) => {
if (opacityValue !== undefined) {
return `rgba(var(${variableName}), ${opacityValue})`;
}
return `rgb(var(${variableName}))`;
};
}
module.exports = {
content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"],
theme: {
extend: {
textColor: {
skin: {
base: withOpacity("--color-text-base"),
accent: withOpacity("--color-text-accent"),
},
},
backgroundColor: {
skin: {
fill: withOpacity("--color-fill"),
card: withOpacity("--color-card"),
},
},
},
},
plugins: [],
};