From ff10297bf88802e35f9a11309e52ee8558348f28 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Thu, 10 Mar 2022 17:22:02 +0530 Subject: [PATCH] Explicitly convert to number --- postcss/color.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/postcss/color.js b/postcss/color.js index 2251a56e..f61dac1e 100644 --- a/postcss/color.js +++ b/postcss/color.js @@ -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; } }