tumble-yellow-dark-vscode/src/classic/process.js
2021-02-02 19:39:54 +09:00

23 lines
374 B
JavaScript

const Color = require("color");
/*
* Generate color variant by inverting
* luminance in the HSL representation
*/
function getVariant(hex, style) {
if (style === "dark") {
const c = Color(hex);
return c
.hsl()
.lightness(100 - c.lightness())
.hex()
.toLowerCase();
} else {
return hex;
}
}
module.exports = {
getVariant,
};