UNPKG

@catppuccin/daisyui

Version:

🌼 Soothing pastel theme for daisyui

51 lines (47 loc) • 1.5 kB
'use strict'; const palette = require('@catppuccin/palette'); const defaultColorOptions = { primary: "lavender", secondary: "surface0", accent: "rosewater", neutral: "overlay1", success: "green", warning: "yellow", error: "red", info: "sky" }; function getSemanticColors(options = {}) { return { ...defaultColorOptions, ...options }; } function createFlavor(theme, options) { const palette$1 = palette.flavorEntries.find(([name]) => name === theme)?.[1]; if (!palette$1) 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$1.dark ? "dark" : "light", "base-100": palette$1.colors.base.hex, "base-200": palette$1.colors.mantle.hex, "base-300": palette$1.colors.crust.hex, "primary": palette$1.colors[primary].hex, "secondary": palette$1.colors[secondary].hex, "accent": palette$1.colors[accent].hex, "neutral": palette$1.colors[neutral].hex, "success": palette$1.colors[success].hex, "warning": palette$1.colors[warning].hex, "error": palette$1.colors[error].hex, "info": palette$1.colors[info].hex } }; return daisyTheme; } module.exports = createFlavor;