@catppuccin/daisyui
Version:
🌼 Soothing pastel theme for daisyui
71 lines (69 loc) • 2.36 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
default: () => src_default
});
module.exports = __toCommonJS(src_exports);
var import_palette = require("@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 = import_palette.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;