LWXGL maintains a 16-entry color palette (indices 0–15). Every color argument throughout the API — border colors, fill colors, text colors, primitive drawing colors — is an index into this palette. The palette is initialized from compile-time defaults whenDocumentation 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.
GCreateWindow is called, and can be freely inspected and modified at runtime.
GPaletteQuery
idx by querying the X11 colormap via XQueryColor.
idx— palette index to query (0–15).r,g,b— pointers tounsigned charvariables that receive the red, green, and blue components (0–255) of the color at that index.
GPaletteModify call.
GPaletteModify
idx with a new RGB color. The old X11 color allocation is freed and a new one is allocated in the default colormap.
idx— palette index to replace (0–15).r,g,b— new red, green, and blue components (0–255).redraw— if non-zero, callsGRedrawAllImagesafter updating the palette entry to repaint all image canvases using the new color mapping.
colors[idx] pixel value is updated — the color_palette defaults array is not modified, so GPaletteReset will still restore the original factory values.
GPaletteReset
main.cc) and then calls GRedrawAllImages to repaint all image canvases.
All 16 existing color allocations are freed at once before the defaults are re-allocated, ensuring no stale entries remain in the X11 colormap.
Default Palette
| Index | Name | Hex | R | G | B |
|---|---|---|---|---|---|
| 0 | Black | #000000 | 0 | 0 | 0 |
| 1 | Dark Blue | #0303AD | 3 | 3 | 173 |
| 2 | Dark Green | #00AA00 | 0 | 170 | 0 |
| 3 | Dark Cyan | #00A8A8 | 0 | 168 | 168 |
| 4 | Dark Red | #BA0606 | 186 | 6 | 6 |
| 5 | Dark Magenta | #A800A8 | 168 | 0 | 168 |
| 6 | Orange | #E67E22 | 230 | 126 | 34 |
| 7 | Light Gray | #A8A8A8 | 168 | 168 | 168 |
| 8 | Dark Gray | #555753 | 85 | 87 | 83 |
| 9 | Light Blue | #5757FF | 87 | 87 | 255 |
| 10 | Light Green | #55FF55 | 85 | 255 | 85 |
| 11 | Light Cyan | #60F0F0 | 96 | 240 | 240 |
| 12 | Light Red | #FF5555 | 255 | 85 | 85 |
| 13 | Light Magenta | #F054F0 | 240 | 84 | 240 |
| 14 | Yellow | #F4F236 | 244 | 242 | 54 |
| 15 | White | #FFFFFF | 255 | 255 | 255 |
GRedrawAllImages
prev buffer bytes to 255, guaranteeing every pixel is considered changed and re-pushed to the X11 image).
This function is called automatically by GPaletteModify (when redraw != 0) and always by GPaletteReset. Call it manually after any external change — such as directly modifying an image’s raw data buffer via GGetImageData — that requires a full canvas refresh rather than an incremental update.