LWXGL uses a 16-entry color palette shared by all rendering. Every color parameter accepted by widgets, drawing primitives, and image canvases is a palette index in the range 0–15. Modifying a palette entry at runtime recolors all elements and image pixels that reference that index — on the nextDocumentation 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.
GRenderWindow() call for widgets, and immediately for image canvases when the redraw flag is set.
GPaletteQuery
XQueryColor. Because the result comes from the live X11 colormap allocation rather than a cached copy, it always reflects the most recent state — including any changes made by GPaletteModify.
Palette index to query. Must be in the range 0–15.
Output pointer. On return, receives the red component of the color (0–255).
Output pointer. On return, receives the green component of the color (0–255).
Output pointer. On return, receives the blue component of the color (0–255).
The values returned by
GPaletteQuery are divided by 257 from the underlying 16-bit X11 color components, so they are always in the 8-bit range 0–255 regardless of display depth.GPaletteModify
XFreeColors and a fresh one is allocated with XAllocColor. All widgets that reference this index will render with the new color the next time GRenderWindow() is called — no extra step is required for widget elements. Image canvas pixels that use this index are only updated if redraw is non-zero.
Palette index to replace. Must be in the range 0–15.
New red component (0–255).
New green component (0–255).
New blue component (0–255).
When non-zero,
GRedrawAllImages() is called automatically after the palette entry is updated, refreshing all image canvases. Pass 0 to defer the redraw (e.g. when batching multiple palette changes before a single redraw).GRenderWindow reads palette colors live on every frame, so widgets (buttons, text, rects, etc.) always pick up palette changes without needing GRedrawAllImages. Only image canvas pixel data — which is pre-rendered into pixmaps — requires a redraw pass.GPaletteReset
color_palette table. GRedrawAllImages() is called automatically after the reset to refresh image canvas pixel data.
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 |