UNPKG

color-fns

Version:

Modern JavaScript color utility library.

19 lines 685 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var utils_1 = require("./utils"); function mix(c1, c2, ratio) { var red = Math.floor(utils_1.mixValue(c1.red, c2.red, ratio)); var green = Math.floor(utils_1.mixValue(c1.green, c2.green, ratio)); var blue = Math.floor(utils_1.mixValue(c1.blue, c2.blue, ratio)); var alpha1 = typeof c1.alpha === 'number' ? c1.alpha : 1; var alpha2 = typeof c2.alpha === 'number' ? c2.alpha : 1; var alpha = utils_1.mixValue(alpha1, alpha2, ratio); return { alpha: alpha, blue: blue, green: green, red: red }; } exports.mix = mix; //# sourceMappingURL=mix.js.map