-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (38 loc) · 1.25 KB
/
index.js
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
34
35
36
37
38
39
40
41
const plugin = require('tailwindcss/plugin')
const flattenColorPalette = require('tailwindcss/lib/util/flattenColorPalette').default
module.exports = plugin(function ({ matchUtilities, theme, addBase }) {
// Add default configuration
addBase({
':root': {
'--tw-inverted-border-color': '#000',
},
})
// Create the inverted-border-{size} utility
matchUtilities(
{
'inverted-border': (value) => ({
width: value,
height: value,
aspectRatio: '1',
backgroundImage: `radial-gradient(circle at 100% 100%, transparent calc(${value} - 1px), var(--tw-inverted-border-color) ${value})`,
isolation: 'isolate', // Ensures proper stacking context
}),
},
{
values: theme('borderRadius'),
supportsNegativeValues: false,
}
)
// Create the inverted-border-{color} utility
matchUtilities(
{
'inverted-border': (value) => ({
'--tw-inverted-border-color': value.toString(),
}),
},
{
values: (({ ...colors }) => flattenColorPalette(colors))(theme('colors')),
type: 'color',
}
)
})