Explicitly convert to number

This commit is contained in:
RMidhunSuresh 2022-03-10 17:22:02 +05:30
parent f732164b5f
commit ff10297bf8
1 changed files with 3 additions and 2 deletions

View File

@ -17,13 +17,14 @@ limitations under the License.
const offColor = require("off-color").offColor;
module.exports.derive = function (value, operation, argument) {
const argumentAsNumber = parseInt(argument);
switch (operation) {
case "darker": {
const newColorString = offColor(value).darken(argument / 100).hex();
const newColorString = offColor(value).darken(argumentAsNumber / 100).hex();
return newColorString;
}
case "lighter": {
const newColorString = offColor(value).lighten(argument / 100).hex();
const newColorString = offColor(value).lighten(argumentAsNumber / 100).hex();
return newColorString;
}
}