forked from phuctm97/tailwindcss-shadow-fill
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
23 lines (21 loc) · 724 Bytes
/
index.js
File metadata and controls
23 lines (21 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const plugin = require("tailwindcss/plugin");
const flatten = require("flatten-tailwindcss-theme");
const shadowFill = plugin(
({ addUtilities, variants, theme, e }) => {
const colors = flatten(theme("colors"));
const utils = Object.entries(colors).reduce(
(res, [key, value]) =>
Object.assign(res, {
[`.${e(`shadow-fill-${key}`)}`]: {
"--tw-shadow": `0 0 0 9999px ${value} inset`,
boxShadow:
"var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)",
},
}),
{}
);
addUtilities(utils, variants("shadowFill"));
},
{ variants: { shadowFill: [] } }
);
module.exports = shadowFill;