Thread: Bit Encoded Colors.

  1. #1
    Registered User
    Join Date
    Jun 2008

    Bit Encoded Colors.

    How do i allow my console to accept true colors?

    And How do the byte encoded colors work like

    char Color = 0xF F A 5  F  F
                   | | | |  |  |
                   1 2 3 4  5  6   Bits?
    And what elements does each bit control?
    Would be glad if someone helped me out im scouring the internet but i havent found an answer.
    Last edited by Nathan the noob; 07-30-2010 at 06:59 PM.
    Who needs a signature?

  2. #2
    Registered User
    Join Date
    Jun 2008


    What im asking is how do i access more than the 16 standard colors.
    Who needs a signature?

  3. #3
    Just a pushpin. bernt's Avatar
    Join Date
    May 2009
    This isn't a standard feature and is not supported by all terminals.

    The Windows terminal supports 16 colors and that's the end of that.

    However many other terminals support more colors. Xterm, for one, has a 256 color extension. And so do most of the *nix terminals - Konsole, gnome-terminal, etc.
    (And as long as you're compiling terminals with extensions, you may as well compile ncurses with the 256-color extension too.)

    EDIT: Just so you know, you're probably better off sticking with 16 colors since the 256 color thing is an extension and is disabled even in some versions of xterm.

    And for byte-encoded colors, the most common meaning is 1 byte (2 hexadecimal digits) for each color RGB: 0xRRGGBB.
    So 0x00FF00 is green (255 for each g, 0 for r and b), 0xFFFFFF is white, and 0xFFA5FF is a really light purple. But most of the time when you have to define colors there ought to be a color-mapping routine, because 2-bits-to-a-color is not always the case.
    Last edited by bernt; 07-31-2010 at 10:29 AM.
    Consider this post signed

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. bit value check efficiency
    By George2 in forum C Programming
    Replies: 5
    Last Post: 11-05-2007, 07:59 AM
  3. Bitwise Operators - Setting and Retreiving a Bit
    By Spono in forum C Programming
    Replies: 2
    Last Post: 11-04-2003, 02:09 PM
  4. 16 bit colors
    By morbuz in forum Game Programming
    Replies: 13
    Last Post: 11-10-2001, 01:49 AM
  5. Array of boolean
    By DMaxJ in forum C++ Programming
    Replies: 11
    Last Post: 10-25-2001, 11:45 PM