UNPKG

maz-ui

Version:

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

1 lines 1.22 kB
import{baseColors,colorScales,noForegroundColors,scaleColors}from"../variables/colors.js";function getColors(){let colors=baseColors;for(let[colorNameTailwind,variableName]of Object.entries(scaleColors)){let 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){let 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){let color=`hsl(var(--maz-${colorName}) / <alpha-value>)`;return withForeground?{DEFAULT:color,foreground:`hsl(var(--maz-${colorName}-foreground) / <alpha-value>)`}:color}export{createScaleColor,createSimpleColor,getColors};