@kcuf/mere-color
Version:
Mere color utils for generating, manipulation, a11y purposes.
23 lines (22 loc) • 616 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = tint;
var _util = require("../util");
/**
* Tints a color by mixing it with white.
*
* `tint` can produce hue shifts, whereas `lighten` manipulates the luminance channel and therefore
* doesn't produce hue shifts.
*/
function tint(color) {
var percentage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
return (0, _util.manipulateRgb)(color, function (rgb) {
return (0, _util.rgbMix)(rgb, {
r: 255,
g: 255,
b: 255
}, [100 - percentage, percentage]);
});
}