@kcuf/mere-color
Version:
Mere color utils for generating, manipulation, a11y purposes.
19 lines (18 loc) • 553 B
JavaScript
import { manipulateRgb, rgbMix } from '../util';
/**
* Shades a color by mixing it with black.
*
* `shade` can produce hue shifts, whereas `darken` manipulates the luminance channel and therefore
* doesn't produce hue shifts.
*/
export default function shade(color) {
var percentage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
return manipulateRgb(color, function (rgb) {
return rgbMix(rgb, {
r: 0,
g: 0,
b: 0
}, [100 - percentage, percentage]);
});
}
//# sourceMappingURL=shade.js.map