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
519 B
JavaScript
Raw Normal View History

2021-01-05 10:52:05 +00:00
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})`;
},
2021-01-07 16:29:23 +00:00
spacer(number = 1) {
2021-01-07 14:57:05 +00:00
return `calc(var(--spacer-height, 1.5rem) * ${number})`;
},
2021-01-05 10:52:05 +00:00
};
module.exports = postcssFunctions;