2021-04-02 11:58:41 -04:00
|
|
|
const flattenColorPalette = require('../../lib/util/flattenColorPalette').default
|
|
|
|
|
const toColorValue = require('../../lib/util/toColorValue').default
|
2021-04-02 11:16:15 -04:00
|
|
|
const { asColor, nameClass } = require('../pluginUtils')
|
|
|
|
|
|
2021-04-02 14:12:47 -04:00
|
|
|
module.exports = function ({ matchUtilities, theme }) {
|
|
|
|
|
let colorPalette = flattenColorPalette(theme('fill'))
|
2021-04-02 11:16:15 -04:00
|
|
|
|
|
|
|
|
matchUtilities({
|
2021-04-02 14:12:47 -04:00
|
|
|
fill: (modifier) => {
|
2021-04-02 11:16:15 -04:00
|
|
|
let value = asColor(modifier, colorPalette)
|
|
|
|
|
|
|
|
|
|
if (value === undefined) {
|
|
|
|
|
return []
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return { [nameClass('fill', modifier)]: { fill: toColorValue(value) } }
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
}
|