jc-color
Version:
A JavaScript tool for color compute and console print tool both for NodeJS and Browser.
1 lines • 746 B
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0}),exports.shadeColor=exports.tintColor=exports.mixColor=void 0;const jc_utils_1=require("@jcstdio/jc-utils"),_1=require("."),converters_1=require("../converters");function mixColor(r,o,e){let t,i;t=(0,jc_utils_1.isString)(r)?(0,converters_1.stringColorToChannels)(r):r,i=(0,jc_utils_1.isString)(r)?(0,converters_1.stringColorToChannels)(o):o;r=e,o=1-e;return{red:Math.round(t.red*r+i.red*o),green:Math.round(t.green*r+i.green*o),blue:Math.round(t.blue*r+i.blue*o)}}function tintColor(r,o){return mixColor(_1.colorsDict.white,r,o)}function shadeColor(r,o){return mixColor(_1.colorsDict.black,r,o)}exports.mixColor=mixColor,exports.tintColor=tintColor,exports.shadeColor=shadeColor;