tailwindcss/src/plugins/divideColor.js

34 lines
935 B
JavaScript
Raw Normal View History

2020-04-16 11:01:24 -04:00
import flattenColorPalette from '../util/flattenColorPalette'
import withAlphaVariable from '../util/withAlphaVariable'
2020-04-16 11:01:24 -04:00
2020-10-16 13:30:06 -04:00
export default function () {
return function ({ matchUtilities, theme, variants, corePlugins }) {
matchUtilities(
{
divide: (value) => {
if (!corePlugins('divideOpacity')) {
return {
['& > :not([hidden]) ~ :not([hidden])']: {
'border-color': value,
},
}
}
return {
['& > :not([hidden]) ~ :not([hidden])']: withAlphaVariable({
color: value,
property: 'border-color',
variable: '--tw-divide-opacity',
}),
}
},
},
{
values: (({ DEFAULT: _, ...colors }) => colors)(flattenColorPalette(theme('divideColor'))),
variants: variants('divideColor'),
type: 'color',
}
)
2020-04-16 11:01:24 -04:00
}
}