UNPKG

maz-ui

Version:

A standalone components library for Vue.Js 3 & Nuxt.Js 3

26 lines (25 loc) 1.36 kB
import { scaleColors, colorScales, noForegroundColors, baseColors } from "../variables/colors.js"; function getColors() { const colors = baseColors; for (const [colorNameTailwind, variableName] of Object.entries(scaleColors)) { const colorVariations = colorScales.reduce((variants, scale) => (variants[scale] = `hsl(var(--maz-${variableName}-${scale}) / <alpha-value>)`, variants), {}); colorVariations.DEFAULT = `hsl(var(--maz-${variableName}) / <alpha-value>)`, noForegroundColors.includes(colorNameTailwind) || (colorVariations.foreground = `hsl(var(--maz-${variableName}-foreground) / <alpha-value>)`), colors[colorNameTailwind] = colorVariations; } return colors; } function createScaleColor(colorName) { const variants = colorScales.reduce((acc, scale) => (acc[scale] = `hsl(var(--maz-${colorName}-${scale}) / <alpha-value>)`, acc), {}); return variants.DEFAULT = `hsl(var(--maz-${colorName}) / <alpha-value>)`, variants.foreground = `hsl(var(--maz-${colorName}-foreground) / <alpha-value>)`, variants; } function createSimpleColor(colorName, withForeground = !1) { const color = `hsl(var(--maz-${colorName}) / <alpha-value>)`; return withForeground ? { DEFAULT: color, foreground: `hsl(var(--maz-${colorName}-foreground) / <alpha-value>)` } : color; } export { createScaleColor, createSimpleColor, getColors };