I\'m trying to create a color opposite of current color. I mean if current color is black, then I need to generate white.
Actually I have a text
Simple and elegant.
function invertHex(hex) { return (Number(`0x1${hex}`) ^ 0xFFFFFF).toString(16).substr(1).toUpperCase() } invertHex('00FF00'); // Returns FF00FF