forked from mystiq/hydrogen-web
Explicitly convert to number
This commit is contained in:
parent
f732164b5f
commit
ff10297bf8
1 changed files with 3 additions and 2 deletions
|
@ -17,13 +17,14 @@ limitations under the License.
|
||||||
const offColor = require("off-color").offColor;
|
const offColor = require("off-color").offColor;
|
||||||
|
|
||||||
module.exports.derive = function (value, operation, argument) {
|
module.exports.derive = function (value, operation, argument) {
|
||||||
|
const argumentAsNumber = parseInt(argument);
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case "darker": {
|
case "darker": {
|
||||||
const newColorString = offColor(value).darken(argument / 100).hex();
|
const newColorString = offColor(value).darken(argumentAsNumber / 100).hex();
|
||||||
return newColorString;
|
return newColorString;
|
||||||
}
|
}
|
||||||
case "lighter": {
|
case "lighter": {
|
||||||
const newColorString = offColor(value).lighten(argument / 100).hex();
|
const newColorString = offColor(value).lighten(argumentAsNumber / 100).hex();
|
||||||
return newColorString;
|
return newColorString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue