E
Evertjan.
wrote on 09 sep 2006 in comp.lang.javascript:
You forget the skipping of the #, and later the adding again,
and the adding of leading zero's,
[ff0000 would return ffff in your example, not 00ffff],
which makes it just as difficult, IMHO.
There is always the choice of string manipulation and number crunching.
//I forgot: we need to convert it to hex string
var invertedColor=(0xFFFFFF-parseInt(hexColor,16)).toString(16)
//now we just have to add leading zeroes if needed
You forget the skipping of the #, and later the adding again,
and the adding of leading zero's,
[ff0000 would return ffff in your example, not 00ffff],
which makes it just as difficult, IMHO.
There is always the choice of string manipulation and number crunching.