All colors in LWXGL are palette indices 0–15. Rather than specifying raw RGB values directly when drawing, every element and image canvas references one of these 16 slots. The palette functions let you read, modify, and reset the RGB values behind each index at runtime — changes take effect immediately across all rendered content that references the affected slot.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.
GPaletteQuery
idx by querying the X colormap.
Parameters
| Parameter | Type | Description |
|---|---|---|
idx | int | Palette index to query (0–15) |
r | unsigned char* | Output pointer filled with the red component (0–255) |
g | unsigned char* | Output pointer filled with the green component (0–255) |
b | unsigned char* | Output pointer filled with the blue component (0–255) |
Example
GPaletteModify
idx with the given RGB values. The old X colormap entry is freed and a new one is allocated in its place.
Parameters
| Parameter | Type | Description |
|---|---|---|
idx | int | Palette index to modify (0–15) |
r | unsigned char | New red component (0–255) |
g | unsigned char | New green component (0–255) |
b | unsigned char | New blue component (0–255) |
redraw | int | If non-zero, calls GRedrawAllImages() after updating the color |
When modifying multiple palette entries in sequence, pass
redraw=0 for all but the last call to avoid redundant redraws. GRedrawAllImages will then fire exactly once after all changes are in place.Example
GPaletteReset
main.cc) and calls GRedrawAllImages().
Default palette
| 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 |