UNPKG

@thangk/easythemer

Version:

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

22 lines 989 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const _1 = require("."); const constants_1 = require("../constants"); const converters_1 = require("../converters"); function generateShades(inputOption, inputShadeFactorsSet) { let shadeSet = {}; const { hex } = inputOption; const workingShadeFactorsSet = inputShadeFactorsSet ? inputShadeFactorsSet : constants_1.defaultShadeFactorsSet; for (const [key, value] of Object.entries(workingShadeFactorsSet.shadeFactors)) { if (!value) { shadeSet[key] = hex; continue; } const { h: hh, s: ss, l: ll } = (0, converters_1.HexToHSL)(hex); const { h, s, l } = (0, _1.getBoundSteps)({ h: hh, s: ss, l: ll }, inputOption, value); shadeSet[key] = (0, converters_1.HSLToHex)({ type: constants_1.TYPE.HSL, h, s, l }); } return shadeSet; } exports.default = generateShades; //# sourceMappingURL=generateShades.js.map