@kcuf/mere-color
Version:
Mere color utils for generating, manipulation, a11y purposes.
21 lines (20 loc) • 645 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = fadeIn;
var _util = require("../util");
/**
* Decrease the transparency (or increase the opacity) of a color, making it more opaque.
*
* 参考 https://lesscss.org/functions/#color-operations-fadein
*/
function fadeIn(color) {
var deltaAlpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
var max = arguments.length > 2 ? arguments[2] : undefined;
return (0, _util.manipulateRgb)(color, function (rgb) {
return (0, _util.rgbShiftAlpha)(rgb, deltaAlpha > 0 ? deltaAlpha : 0, {
max: max
});
});
}