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

2021-01-05 10:52:05 +00:00
const postcssFunctions = {
2021-02-17 15:46:49 +00:00
// takes the custom property defined by a color defining mixin, along
2021-01-05 10:52:05 +00:00
// with an alpha value and returns the derived css hsla() function.
2021-02-17 15:46:49 +00:00
alpha(name, alpha) {
2021-01-05 10:52:05 +00:00
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;