Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Color Table
Stores RGBA color values that can be referenced by pixmap data.
- Pixmap palettes - When linked to a Pixmap Table, provides the color palette for indexed pixel data.
- Color storage - Can store color sets independently for other purposes.
- Value:
0x03
| Bit | Name | Description |
|---|---|---|
| 0 | use_color_type | Each record includes a color_type field indicating the color mutability type. |
| 1-7 | — | Reserved for future use. |
use_color_type: When disabled, the default color type is dynamic. The rendering engine may change the RGBA color to support features such as, but not limited to; text color, and/or palette theming.
| Bit | Name | Description |
|---|---|---|
| 0 | use_constant_alpha | All colors in this table share the same alpha value. |
| 1-7 | — | Reserved for future use. |
| Name | Type | Condition | Description |
|---|---|---|---|
constant_alpha | u8 | If use_constant_alpha is enabled. | The alpha channel value applied to all colors in this table. |
| Bit | Name | Description |
|---|---|---|
| 0-7 | — | Reserved for future use. |
The Color Table links to no other table. The byte is still written, as 0x00.
Each record contains the following fields in order:
| Field | Type | Condition | Description |
|---|---|---|---|
color_type | u8 | If use_color_type modifier is enabled. | Color Type value (0 = Dynamic, 1 = Absolute). |
custom_alpha | u8 | If constant_alpha configuration is not set | Alpha channel value (0 = fully transparent, 255 = fully opaque). |
red | u8 | Always present | Red channel value. |
green | u8 | Always present | Green channel value. |
blue | u8 | Always present | Blue channel value. |
Example 1: Minimal record
No modifier flags, and use_constant_alpha enabled so the table supplies alpha.
| Byte | Field | Binary | Hex | Description |
|---|---|---|---|---|
| 1 | red | 11111111 | FF | Red = 255 |
| 2 | green | 00000000 | 00 | Green = 0 |
| 3 | blue | 10101010 | AA | Blue = 170 |
Result: rgb(255, 0, 170), a magenta taking its alpha from constant_alpha.
Example 2: With custom alpha
use_constant_alpha is not set, so every record carries its own alpha.
| Byte | Field | Binary | Hex | Description |
|---|---|---|---|---|
| 1 | custom_alpha | 10000000 | 80 | Alpha = 128, roughly 50% |
| 2 | red | 11111111 | FF | Red = 255 |
| 3 | green | 11111111 | FF | Green = 255 |
| 4 | blue | 11111111 | FF | Blue = 255 |
Result: rgba(255, 255, 255, 128), a 50% transparent white.
Example 3: With all optional fields
use_color_type enabled and no constant_alpha set.
| Byte | Field | Binary | Hex | Description |
|---|---|---|---|---|
| 1 | color_type | 00000001 | 01 | 1 = Absolute |
| 2 | custom_alpha | 11111111 | FF | Alpha = 255, fully opaque |
| 3 | red | 00000000 | 00 | Red = 0 |
| 4 | green | 00000000 | 00 | Green = 0 |
| 5 | blue | 00000000 | 00 | Blue = 0 |
Result: rgba(0, 0, 0, 255), an absolute black that a renderer should not recolor.
The following byte sequence defines a two-entry palette with a shared alpha, one dynamic color and one absolute color:
| Bytes | Binary | Hex | Description |
|---|---|---|---|
| 1 | 00000011 | 03 | Table identifier for Color Table |
| 2 | 00000001 | 01 | Modifier flags: use_color_type enabled |
| 3 | 00000001 | 01 | Configuration flags: use_constant_alpha enabled |
| 4 | 11111111 | FF | constant_alpha = 255, fully opaque |
| 5 | 00000000 | 00 | Table links: none set |
| 6 | 00000010 | 02 | Record count = 2 colors |
| 7 | 00000000 | 00 | Color 0: color_type = 0 (Dynamic) |
| 8 | 00000000 | 00 | Color 0: red = 0 |
| 9 | 00000000 | 00 | Color 0: green = 0 |
| 10 | 00000000 | 00 | Color 0: blue = 0 |
| 11 | 00000001 | 01 | Color 1: color_type = 1 (Absolute) |
| 12 | 11111111 | FF | Color 1: red = 255 |
| 13 | 11111111 | FF | Color 1: green = 255 |
| 14 | 11111111 | FF | Color 1: blue = 255 |