mirror of
https://github.com/linkwarden/linkwarden.git
synced 2026-06-28 14:55:49 +00:00
40 lines
884 B
JavaScript
40 lines
884 B
JavaScript
/** @type {import('tailwindcss').Config} */
|
|
|
|
const { rawTheme } = require("./lib/colors");
|
|
|
|
const hexToRgb = (hex) => {
|
|
const [r, g, b] = hex
|
|
.replace(/^#/, "")
|
|
.match(/.{2}/g)
|
|
.map((h) => parseInt(h, 16));
|
|
return `${r} ${g} ${b}`;
|
|
};
|
|
|
|
module.exports = {
|
|
content: ["./app/**/*.{js,jsx,ts,tsx}", "./components/**/*.{js,jsx,ts,tsx}"],
|
|
presets: [require("nativewind/preset")],
|
|
darkMode: "media",
|
|
theme: {
|
|
extend: {
|
|
colors: Object.fromEntries(
|
|
Object.keys(rawTheme.light).map((key) => [
|
|
key,
|
|
`rgb(var(--color-${key}) / <alpha-value>)`,
|
|
])
|
|
),
|
|
},
|
|
},
|
|
plugins: [
|
|
({ addBase }) => {
|
|
addBase({
|
|
":root": Object.fromEntries(
|
|
Object.entries(rawTheme.light).map(([key, hex]) => [
|
|
`--color-${key}`,
|
|
hexToRgb(hex),
|
|
])
|
|
),
|
|
});
|
|
},
|
|
],
|
|
};
|