@catppuccin/daisyui
Version:
🌼 Soothing pastel theme for daisyui
50 lines (49 loc) • 1.46 kB
JavaScript
// src/index.ts
import { flavorEntries } from "@catppuccin/palette";
var defaultColorOptions = {
primary: "lavender",
secondary: "subtext1",
accent: "rosewater",
neutral: "overlay1",
success: "green",
warning: "yellow",
error: "red",
info: "blue"
};
function getSemanticColors(options = {}) {
return { ...defaultColorOptions, ...options };
}
function createFlavor(theme, options) {
var _a;
const palette = (_a = flavorEntries.find(([name]) => name === theme)) == null ? void 0 : _a[1];
if (!palette)
throw new Error(`Flavor ${theme} not found!`);
let customColors;
if (typeof options === "string") {
customColors = getSemanticColors({
accent: options
});
} else {
customColors = getSemanticColors(options);
}
const { primary, secondary, accent, neutral, info, success, error, warning } = customColors;
const daisyTheme = {
[theme]: {
"color-scheme": palette.dark ? "dark" : "light",
"base-100": palette.colors.base.hex,
"primary": palette.colors[primary].hex,
"secondary": palette.colors[secondary].hex,
"accent": palette.colors[accent].hex,
"neutral": palette.colors[neutral].hex,
"success": palette.colors[success].hex,
"warning": palette.colors[warning].hex,
"error": palette.colors[error].hex,
"info": palette.colors[info].hex
}
};
return daisyTheme;
}
var src_default = createFlavor;
export {
src_default as default
};