js invert color

Solutions on MaxInterview for js invert color by the best coders in the world

showing results for - "js invert color"
Isabell
01 Feb 2017
1const invertColor = (bg) => {
2	bg=parseInt(Number(bg.replace('#', '0x')), 10)
3  bg=~bg
4  bg=bg>>>0
5  bg=bg&0x00ffffff
6  bg='#' + bg.toString(16).padStart(6, "0")
7  
8  return bg
9}