Colors

AppCUI support 16 colors (foreground and background) for each displayed character. All colors are described using AppCUI::Graphics::Color enum:

enum class Color : unsigned char
{
    Black       = 0x00,
    DarkBlue    = 0x01,
    DarkGreen   = 0x02,
    Teal        = 0x03,
    DarkRed     = 0x04,
    Magenta     = 0x05,
    Olive       = 0x06,
    Silver      = 0x07,
    Gray        = 0x08,
    Blue        = 0x09,
    Green       = 0x0A,
    Aqua        = 0x0B,
    Red         = 0x0C,
    Pink        = 0x0D,
    Yellow      = 0x0E,
    White       = 0x0F,
    Transparent = 0x10,
};

Transparent value can be used to specify that the existing color should be used, instead of replacing it with the new one.

Colors and RGB

Each of the 16 colors has an RGB value (used, for example, by AppCUI::Graphics::Image and by the SDL frontend). An image can also be created from a string where every character is the color of one pixel:

Image img;
img.Create(4, 2, "rRgG"
                 "bByY"); // 4x2 pixels: Red, DarkRed, Green, DarkGreen / Blue, DarkBlue, Yellow, Yellow

The string is read row by row (width characters per row); a character that is not in the table below leaves its pixel unchanged (transparent black - all channels 0 - after Create) and a shorter string leaves the remaining pixels unchanged. The following table shows the characters that represent each color:

Color

RGB

String representation

Color::Black

R:0, G:0, B:0 #000000

0 , (space), . (point)

Color::DarkBlue

R:0, G:0, B:128 #000080

1 , B

Color::DarkGreen

R:0, G:128, B:0 #008000

2 , G

Color::Teal

R:0, G:128, B:128 #008080

3 , T

Color::DarkRed

R:128, G:0, B:0 #800000

4 , R

Color::Magenta

R:128, G:0, B:128 #800080

5 , M, m

Color::Olive

R:128, G:128, B:0 #808000

6

Color::Silver

R:192, G:192, B:192 #C0C0C0

7 , S

Color::Gray

R:128, G:128, B:128 #808080

8

Color::Blue

R:0, G:0, B:255 #0000FF

9 , b

Color::Green

R:0, G:255, B:0 #00FF00

g

Color::Aqua

R:0, G:255, B:255 #00FFFF

A , a, t

Color::Red

R:255, G:0, B:0 #FF0000

r

Color::Pink

R:255, G:0, B:255 #FF00FF

P , p

Color::Yellow

R:255, G:255, B:0 #FFFF00

Y , y

Color::White

R:255, G:255, B:255 #FFFFFF

W , w