dcell.color

Undocumented in source.

Members

Enums

Color
enum Color

Color is a what you think, almost. However, the upper bits of the color are used to indicate special behaviors. If the value upper 24-bits are clear, then the value is an index into a palette (typically it should be less than 256). If the isRGB bit is set, then the lower 24 bits are a 24-bit direct color (RGB).

Functions

darker
bool darker(Color c1, Color c2)

Return true if c1 is darker than c2.

decompose
auto decompose(Color c)

decompose a color into red, green, and blue values.

decompose
void decompose(Color c, int r, int g, int b)
Undocumented in source. Be warned that the author may not have intended to support it.
fromHex
Color fromHex(int rgb)

Create a color from RGB values.

isRGB
bool isRGB(Color c)

Is the color in RGB format? RGB format colors will try to be accurate on the terminal, and will not honor user preferences.

toHex
int toHex(Color c)

Obtain the numeric value of the RGB for the color.

toPalette
Color toPalette(Color c, int numColors)

Given a color, try to find an associated palette entry for it. This will try to find the lowest numbered palette entry. The palette entry might be a higher numbered color than the terminal can support, if it does not support a 256 color palette.

toRGB
Color toRGB(Color c)

Convert a color to RGB form. This is useful to convert palette based colors to their full RGB values, which will provide fidelity when the terminal supports it, but consequently does not honor terminal preferences for color palettes.

Meta