mirror of
https://github.com/DeveloLongScript/MHSF.git
synced 2026-05-07 17:35:00 -05:00
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
|
|
import type { Config } from "tailwindcss";
|
||
|
|
|
||
|
|
import svgToDataUri from "mini-svg-data-uri";
|
||
|
|
|
||
|
|
import flattenColorPalette from "tailwindcss/lib/util/flattenColorPalette";
|
||
|
|
|
||
|
|
export default {
|
||
|
|
theme: {
|
||
|
|
extend: {
|
||
|
|
dropShadow: {
|
||
|
|
"card-hover": ["0 8px 12px #222A350d", "0 32px 80px #2f30370f"],
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
plugins: [
|
||
|
|
addVariablesForColors,
|
||
|
|
({ matchUtilities, theme }: any) => {
|
||
|
|
matchUtilities(
|
||
|
|
{
|
||
|
|
"bg-grid": (value: any) => ({
|
||
|
|
backgroundImage: `url("${svgToDataUri(
|
||
|
|
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="72" height="72" fill="none" stroke="${value}"><path d="M0 .5H31.5V32"/></svg>`,
|
||
|
|
)}")`,
|
||
|
|
}),
|
||
|
|
"bg-grid-small": (value: any) => ({
|
||
|
|
backgroundImage: `url("${svgToDataUri(
|
||
|
|
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="8" height="8" fill="none" stroke="${value}"><path d="M0 .5H31.5V32"/></svg>`,
|
||
|
|
)}")`,
|
||
|
|
}),
|
||
|
|
"bg-dot": (value: any) => ({
|
||
|
|
backgroundImage: `url("${svgToDataUri(
|
||
|
|
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="16" height="16" fill="none"><circle fill="${value}" id="pattern-circle" cx="10" cy="10" r="1.6257413380501518"></circle></svg>`,
|
||
|
|
)}")`,
|
||
|
|
}),
|
||
|
|
},
|
||
|
|
{
|
||
|
|
values: flattenColorPalette(theme("backgroundColor")),
|
||
|
|
type: "color",
|
||
|
|
},
|
||
|
|
);
|
||
|
|
},
|
||
|
|
],
|
||
|
|
} satisfies Config;
|
||
|
|
|
||
|
|
function addVariablesForColors({ addBase, theme }: any) {
|
||
|
|
const allColors = flattenColorPalette(theme("colors"));
|
||
|
|
const newVars = Object.fromEntries(
|
||
|
|
Object.entries(allColors).map(([key, val]) => [`--${key}`, val]),
|
||
|
|
);
|
||
|
|
|
||
|
|
addBase({
|
||
|
|
":root": newVars,
|
||
|
|
});
|
||
|
|
}
|