30 lines
895 B
JavaScript
30 lines
895 B
JavaScript
import _ from 'lodash'
|
|
import flattenColorPalette from '../util/flattenColorPalette'
|
|
import withAlphaVariable from '../util/withAlphaVariable'
|
|
|
|
export default function() {
|
|
return function({ addUtilities, e, theme, variants, config }) {
|
|
if (config('target') === 'ie11') {
|
|
const utilities = _.fromPairs(
|
|
_.map(flattenColorPalette(theme('textColor')), (value, modifier) => {
|
|
return [`.${e(`text-${modifier}`)}`, { color: value }]
|
|
})
|
|
)
|
|
|
|
addUtilities(utilities, variants('textColor'))
|
|
|
|
return
|
|
}
|
|
|
|
const utilities = _.fromPairs(
|
|
_.map(flattenColorPalette(theme('textColor')), (value, modifier) => {
|
|
return [
|
|
`.${e(`text-${modifier}`)}`,
|
|
withAlphaVariable({ color: value, property: 'color', variable: '--text-opacity' }),
|
|
]
|
|
})
|
|
)
|
|
|
|
addUtilities(utilities, variants('textColor'))
|
|
}
|
|
}
|