All colors in LWXGL are expressed as integers 0–15 that index into a shared 16-color palette. This keeps the rendering model simple and uniform: every element, image canvas, and primitive operation refers to the same palette, so a palette swap takes effect instantly across the entire window without touching any individual element.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/DREssedAlarm184/LWXGL/llms.txt
Use this file to discover all available pages before exploring further.
Default palette table
| Index | Name | R | G | B |
|---|---|---|---|---|
| 0 | Black | 0 | 0 | 0 |
| 1 | Dark Blue | 3 | 3 | 173 |
| 2 | Dark Green | 0 | 170 | 0 |
| 3 | Dark Cyan | 0 | 168 | 168 |
| 4 | Dark Red | 186 | 6 | 6 |
| 5 | Dark Magenta | 168 | 0 | 168 |
| 6 | Orange | 230 | 126 | 34 |
| 7 | Light Gray | 168 | 168 | 168 |
| 8 | Dark Gray | 85 | 87 | 83 |
| 9 | Light Blue | 87 | 87 | 255 |
| 10 | Light Green | 85 | 255 | 85 |
| 11 | Light Cyan | 96 | 240 | 240 |
| 12 | Light Red | 255 | 85 | 85 |
| 13 | Light Magenta | 240 | 84 | 240 |
| 14 | Yellow | 244 | 242 | 54 |
| 15 | White | 255 | 255 | 255 |
Packed-nibble color encoding
Many UI elements — buttons, inputs, checkboxes, and consoles — are styled with a singleint that encodes two palette indices in one value:
- The high nibble (bits 7–4) is the border or outline color.
- The low nibble (bits 3–0) is the fill or background color.
0x72 selects Light Gray (7) as the border and Dark Green (2) as the fill:
0x70 (unpressed), 0x72 (hovered), and 0x07 (pressed), giving it a visible state change using only palette indices.
Querying a palette entry
*r, *g, and *b with the current 8-bit RGB values for palette index idx. The values are read back from the X server colormap, so they reflect any in-flight modifications made with GPaletteModify.
Modifying a palette entry
idx with the given RGB values. If redraw is non-zero, GRedrawAllImages is called immediately so that every image canvas re-renders with the updated color — otherwise the change takes effect on the next render pass.
Resetting the palette
GRedrawAllImages to update every image canvas. Use this to undo any runtime palette modifications and return to the standard color set.
Palette and TGA images
TGA image files loaded withchange_palette = 1 (via GAllocateTGA or GCreateTGAImage) will overwrite palette entries 0–15 with the colors embedded in the TGA file’s color map when the image is drawn with GDrawIndexedTGA. This lets a single TGA file carry its own color scheme. See the TGA image guide for details.