I need to make a 256 colors palette just like the one Windows uses

This is a discussion on I need to make a 256 colors palette just like the one Windows uses within the Windows Programming forums, part of the Platform Specific Boards category; Where can I find the intensity of each color component (RGB) on the Windows palette? This is how I have ...

  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    55

    I need to make a 256 colors palette just like the one Windows uses

    Where can I find the intensity of each color component (RGB) on the Windows palette?

    This is how I have to do it:

    Code:
    for(int i=0;i<256;i++){
          colors[i].r=i;
          colors[i].g=i;
          colors[i].b=i;
    }

    That would be getting me a 256 colors gray-scale... What I need is a palette like Windows'.

  2. #2
    Math wizard
    Join Date
    Dec 2006
    Location
    USA
    Posts
    582
    You mean the 666 (aka websafe palette) or 676 format? For the first one, it's easy. 0, 51, 102, 153, 204, and 255 for each RGB color value. For the second, the same as the first applies for the red and blue only but the green uses 0, 43, 85, 128, 170, 213, then 255. As to which Windows uses, there's a strange, but interesting, way to test it. Load an image that has many different colors, snag a screenshot, paste it in MSPaint, and look for patterns in the color numbers.

    Edit: as to generating it, use 3 nested loops, one for each channel, then set the values accordingly.
    Last edited by ulillillia; 04-29-2007 at 04:09 PM. Reason: coding method suggested

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    55
    I didn't understand what you meant... For example, tell me the what the first five colors should be...

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  5. #5
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,307
    Quote Originally Posted by ulillillia View Post
    You mean the 666 (aka websafe palette) or 676 format? For the first one, it's easy. 0, 51, 102, 153, 204, and 255 for each RGB color value.
    Dude,
    Hex would have been much prettier... 0x00, 0x33, 0x66, 0x99, 0xCC, 0xFF

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to make opengl draw in lighter colors ?
    By jabka in forum Game Programming
    Replies: 2
    Last Post: 12-17-2007, 05:12 AM
  2. Script errors - bool unrecognized and struct issues
    By ulillillia in forum Windows Programming
    Replies: 10
    Last Post: 12-18-2006, 03:44 AM
  3. How can I use 256 Colors at a time in Turbo C
    By fundu725 in forum C Programming
    Replies: 0
    Last Post: 08-04-2002, 03:14 PM
  4. Replies: 2
    Last Post: 12-31-2001, 07:23 PM
  5. how can I set 256 colors?
    By rahat in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 12-03-2001, 06:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21