Added back exposed colours

This commit is contained in:
Alexis
2024-05-12 23:50:22 +02:00
parent 4e9bc4137b
commit bb88074215
2 changed files with 21 additions and 3 deletions

View File

@@ -13,7 +13,7 @@ module.exports = {
"./app.vue",
"./error.vue",
],
theme: {
container: {
center: true,
@@ -92,5 +92,23 @@ module.exports = {
},
plugins: [
animate,
function ({ addBase, theme }) {
function extractColorVars(colorObj, colorGroup = '') {
return Object.keys(colorObj).reduce((vars, colorKey) => {
const value = colorObj[colorKey]
const newVars =
typeof value === 'string'
? { [`--color${colorGroup}-${colorKey}`]: value }
: extractColorVars(value, `-${colorKey}`)
return { ...vars, ...newVars }
}, {})
}
addBase({
':root': extractColorVars(theme('colors'))
})
}
]
}
}