Results 1 to 7 of 7

Thread: See the colour of a colour number

  1. #1
    Join Date
    Nov 2010
    Location
    Cleveland, Ohio, U.S.A.
    Posts
    69
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default See the colour of a colour number

    I am debugging a program. It has lists of colour numbers that it has gathered.

    What is an easy way to type (or copy and paste) a colour number onto a (program or webpage) screen and see what the color is?

    Currently, I execute Auto Colour Aid (ACA) and type in the number to do this.

    By the way, if one goes on the Internet and tries to find a solution (with Google), most of them use hexadecimal colour numbers, rather than decimal colour numbers.

  2. #2
    Join Date
    Jun 2014
    Posts
    463
    Mentioned
    27 Post(s)
    Quoted
    229 Post(s)

    Default

    Just use mufasalayer and write a script to create a layer of each color
    Tsunami

  3. #3
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    Just convert the number to hex?
    http://www.binaryhexconverter.com/de...-hex-converter.

    RGB or BGR both take up 24bits of data. 8 bits per channel, They are simply shifted into place:

    Code:
    int main()
    {
        std::uint8_t R = 255, G = 0, B = 0;
        std::uint32_t Col = B << 16 | G << 8 | R;
        std::cout << Col << std::endl;
        std::uint8_t R2, G2, B2;
        B2 = Col / 65536 % 256;
        G2 = Col / 256 % 256;
        R2 = Col % 256;
        std::cout << (std::uint32_t)R2 << ", " << (std::uint32_t)G2 << ", " << (std::uint32_t)B2 << std::endl;
        // or
        std::uint8_t R3 = 0, G3 = 0, B3 = 0;
        B3 = (Col >> 16) & 0xff;
        G3 = (Col >> 8) & 0xff;
        R3 = Col & 0xff;
        std::cout << (std::uint32_t)R3 << ", " << (std::uint32_t)G3 << ", " << (std::uint32_t)B3 << std::endl;
        return 0;
    }
    Last edited by Kasi; 11-29-2016 at 01:45 AM.

  4. #4
    Join Date
    Feb 2012
    Location
    Norway
    Posts
    995
    Mentioned
    145 Post(s)
    Quoted
    596 Post(s)

    Default

    This will open a website that displays the color for you.
    Code:
    {$X+}
    begin
      var hex := IntToHex(some_color, 6);  //replace some_color with eg 255 (the color you wanna look up)
      Swap(hex[1], Hex[5]);
      Swap(hex[2], Hex[6]);
      OpenWebPage('http://www.hexcolortool.com/#'+hex);
    end.
    Last edited by slacky; 11-29-2016 at 02:38 AM.
    !No priv. messages please

  5. #5
    Join Date
    Feb 2006
    Location
    Helsinki, Finland
    Posts
    1,395
    Mentioned
    30 Post(s)
    Quoted
    107 Post(s)

    Default

    With this little script below, you can even check colors directly in Simba itself:

    Simba Code:
    const
      COLOR = 2599013;
      WIDTH = 100;
      HEIGHT = 100;

    var
      bmp: Integer;

    begin
      bmp := CreateBitmap(WIDTH, HEIGHT);
      DisplayDebugImgWindow(WIDTH, HEIGHT);
      DrawTPABitmap(bmp, TPAFromBox(IntToBox(0, 0, (WIDTH - 1), (HEIGHT - 1))), COLOR);
      DrawBitmapDebugImg(bmp);
    end.

  6. #6
    Join Date
    Nov 2010
    Location
    Cleveland, Ohio, U.S.A.
    Posts
    69
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Thank you, Lucidity, Kasi, slacky and Janilabo, for your quick and informative responses.

    I studied each of the solutions. This study has increased my knowledge of colours and Simba.

  7. #7
    Join Date
    Nov 2010
    Location
    Cleveland, Ohio, U.S.A.
    Posts
    69
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Lucidity,

    I researched mufasalayer. I gather that you are referring to TMufasaLayer as described in https://villavu.com/forum/showthread.php?t=110667 TMufasaLayer - Draw on any window!.

    I browsed the thread. This is outside of Simba and a little more than I am willing to tackle right now. However, thank you for introducing it to me. (I especially enjoyed browsing the GitHub: https://github.com/Olly-/mLayer.)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •