LWXGL maps all colors through a fixed 16-entry palette. Every color you specify is an index from 0 to 15 — there are no hex color codes, RGB structs, or named color strings in the API. On startup,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.
GCreateWindow allocates all 16 palette entries in the X11 colormap, and they remain valid for the lifetime of the window.
Palette Reference
| Index | Name | Approx RGB |
|---|---|---|
0 | Black | #000000 |
1 | Dark Blue | #0303AD |
2 | Dark Green | #00AA00 |
3 | Dark Cyan | #00A8A8 |
4 | Dark Red | #BA0606 |
5 | Dark Magenta | #A800A8 |
6 | Orange | #E67E22 |
7 | Light Gray | #A8A8A8 |
8 | Dark Gray | #555753 |
9 | Light Blue | #5757FF |
10 | Light Green | #55FF55 |
11 | Light Cyan | #60F0F0 |
12 | Light Red | #FF5555 |
13 | Light Magenta | #F054F0 |
14 | Yellow | #F4F236 |
15 | White | #FFFFFF |
Direct Color Indices
Most of the API accepts a plainint palette index:
Text & Rectangles
GCreateText color, GCreateRect fg/bgDrawing Primitives
GPrimitiveLine, GPrimitiveRect, GPrimitiveCircle fg/bg, GPrimitiveSprite colorImage Pixel Data
Each byte in the
GGetImageData buffer is a direct palette indexWindow Background
GCreateWindow bgcol parameter#define constant:
Packed Color Bytes
Two widget creation functions —GCreateButton and GCreateInput — accept packed color bytes instead of separate fg/bg parameters. A packed color is a single int where:
- High nibble (bits 7–4): foreground palette index (text color and border color)
- Low nibble (bits 3–0): background palette index (fill color)
Background Color
Thebgcol parameter of GCreateWindow is a direct palette index. It determines the color used to clear the entire window at the start of every GRenderWindow call — effectively the “canvas background” behind all elements.
GCreateRect also accepts direct fg/bg indices with -1 as an opt-out: