forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathborderColor.js
More file actions
33 lines (27 loc) · 930 Bytes
/
Copy pathborderColor.js
File metadata and controls
33 lines (27 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import _ from 'lodash'
import flattenColorPalette from '../util/flattenColorPalette'
import withAlphaVariable from '../util/withAlphaVariable'
export default function() {
return function({ addUtilities, e, theme, variants, target, corePlugins }) {
const colors = flattenColorPalette(theme('borderColor'))
const getProperties = value => {
if (target('borderColor') === 'ie11') {
return { 'border-color': value }
}
if (corePlugins('borderOpacity')) {
return withAlphaVariable({
color: value,
property: 'border-color',
variable: '--border-opacity',
})
}
return { 'border-color': value }
}
const utilities = _.fromPairs(
_.map(_.omit(colors, 'default'), (value, modifier) => {
return [`.${e(`border-${modifier}`)}`, getProperties(value)]
})
)
addUtilities(utilities, variants('borderColor'))
}
}