The inverse of the color

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.