Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function adjust(base, expected, baseVar) {
const _base = chroma(base);
const _expected = chroma(expected);
const mixee = chroma.cmyk(cmykLinear(_base.cmyk(), _expected.cmyk()));
const _actual = chroma.mix(base, mixee);
const _actualHsl = _actual.hsl().slice(1, -1);
const _expectedHsl = _expected.hsl().slice(1, -1);
const differences = _actualHsl.map((channel, idx) => {
return channel - _expectedHsl[idx];
});
const saturationAdjustment = _.round(differences[0] * -100, 6).toString();
const lightnessAdjustment = _.round(differences[1] * -100, 6).toString();
return _l(_s(_b(baseVar, mixee.css('hsl'), 50, false), saturationAdjustment), lightnessAdjustment);
}
swatches.forEach((e, i) => {
const hex = chroma.cmyk(cv(e.cmyk))
const rgb = chroma(hex).rgb()
const colorObject = {
"index": i + 1,
"name": e.name,
"slug": returnSlug(e.name),
"cmyk_array": e.cmyk,
"cmyk": `C:${e.cmyk[0]} / M:${e.cmyk[1]} / Y:${e.cmyk[2]} / K:${e.cmyk[3]}`,
"rgb_array": rgb,
"rgb": `R:${rgb[0]} / G:${rgb[1]} / B:${rgb[2]}`,
"hex": `${hex}`,
"combinations": e.combinations,
"use_count": e.combinations.length
}
colorList.push(colorObject)
})
return colorList