16 lines
520 B
JavaScript
16 lines
520 B
JavaScript
const postcssFunctions = {
|
|
// takes the custom property defined by defineColor or defineColorAlpha, along
|
|
// with an alpha value and returns the derived css hsla() function.
|
|
toHSLA(name, alpha) {
|
|
const hue = `var(${name}__h)`;
|
|
const saturation = `var(${name}__s)`;
|
|
const lightness = `var(${name}__l)`;
|
|
return `hsla(${hue}, ${saturation}, ${lightness}, ${alpha})`;
|
|
},
|
|
spacers(number = 1) {
|
|
return `calc(var(--spacer-height, 1.5rem) * ${number})`;
|
|
},
|
|
};
|
|
|
|
module.exports = postcssFunctions;
|