UNPKG

@thangk/easythemer

Version:

Easily generate shades from a colour palette for use in your app

37 lines 1.65 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const _1 = require("."); const constants_1 = require("../constants"); function getBoundSteps(HSLInput, inputShadeOption, shadeFactor) { const hslArray = ["h", "s", "l"]; let hslArrayIndex = 0; inputShadeOption.channelParams?.forEach((channelParam) => { for (const [key, value] of Object.entries(channelParam)) { if (hslArray[hslArrayIndex] === value) { // use default bounds if (!channelParam.useBounds) { const mergedChannelParams = Object.assign(constants_1.defaultChannelParams, channelParam); HSLInput[hslArray[hslArrayIndex]] = (0, _1.getChannelValue)({ shadeFactor, HSL_channel: HSLInput[hslArray[hslArrayIndex]], HSL_letter: hslArray[hslArrayIndex], workingObj: mergedChannelParams, }); } // use custom bounds if (channelParam.useBounds) { HSLInput[hslArray[hslArrayIndex]] = (0, _1.getChannelValue)({ shadeFactor, HSL_channel: HSLInput[hslArray[hslArrayIndex]], HSL_letter: hslArray[hslArrayIndex], workingObj: constants_1.defaultChannelParams, }); } } } hslArrayIndex++; }); return HSLInput; } exports.default = getBoundSteps; //# sourceMappingURL=getBoundSteps.js.map