The hexadecimal representation of the color value, converted to decimal, and then 255 minus the decimal value, and finally to 16 binary value is indicated:
For example: Originally #ff0000 with its opposite color is #00ffff
function Changergb (Rgbs) {var arr = rgbs.split ('); Console.log (RGBS); var rgb1 = Arr[1].concat (arr[2]); Console.log (RGB1); var rgb2 = Arr[3].concat (arr[4]); Console.log (RGB2); var rgb3 = Arr[5].concat (arr[6]); Console.log (RGB3); var arr1 = []; Arr1[0] = parseint (RGB1, 16); Console.log (Arr1[0]); ARR1[1] = parseint (RGB2, 16); Console.log (arr1[1]); ARR1[2] = parseint (RGB3, 16); Console.log (arr1[2]); var rgb10=arr1.join (","); var rgb16 = []; for (var i = 0; i < arr1.length; i++) {Rgb16[i] = (255-arr1[i]). toString (2). toUpperCase (); if (Rgb16[i].length < 2) {Rgb16[i] = "0". Concat (Rgb16[i]); }}//console.log (Rgb16[0]); Console.log (rgb16[1]); Console.log (rgb16[2]); var result = Rgb16.join ("); Alert ("#" + result); }
Inverse of color