jQuery-xcolor
                                
                                 jQuery-xcolor copied to clipboard
                                
                                    jQuery-xcolor copied to clipboard
                            
                            
                            
                        complementary color don't work right
it pick black if you pick black or almost black instead of white
>>> $.xcolor.complementary('#131111').getHex()
"#111313" // different kind of black
>>> $.xcolor.complementary('#000000').getHex()
"#000000"
>>> $.xcolor.complementary('#ffffff').getHex()
"#ffffff"
I found library that do this right http://matthewbj.github.com/Colors/
Well, if you take a look into the project history, you'll see that I changed the behavior of the complementary function with version 1.6: https://github.com/infusion/jQuery-xcolor/commit/afe53c4d3c89da5303306a17a50b2b6a8d56acbf
I decided to change this, because a mathematical complement isn't really useful in practice. That's why I used a visual complement, like when you rotate the hue of the HSL spectrum.
If you really need the mathematical complement, use xcolor like so:
var tmp = $.xcolor.test('#111313').getInt(); if (tmp !== null) { $.xcolor.test(tmp ^ 0xffffff).getHex(); } else { // original color couldn't be parsed }