This repository has been archived on 2021-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
postcss/functions.js

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;