13 lines
430 B
JavaScript
13 lines
430 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})`;
|
||
|
},
|
||
|
};
|
||
|
|
||
|
module.exports = postcssFunctions;
|