coloX Platform Specifications
coloX applications declare their target platform specification in the file header. Specifications differ in resolution, color depth, sprite counts, and storage space.
Contents
1. Specification Identifiers
The first line of a .clx file is the specification identifier, defining canvas dimensions, color depth, and resource limits:
coloX-16
| Format | Description |
|---|---|
coloX-{specification suffix} | Fixed specification, such as coloX-4, coloX-16, or coloX-32C |
X-{width}x{height}_{bpp} | Custom specification, such as X-240x240_16 (generates the corresponding memory layout as needed) |
coloX-PICO8 | Alias for X-128x128_4 (128×128 4bpp compatible specification) |
2. Complete Specification Tables
Standard Specifications (240×240 Round Screen)
| Specification | Resolution | Color depth (bpp) | Sprites | Map dimensions | ROM limit |
|---|---|---|---|---|---|
coloX-4P | 128×128 | 4 | 512 (16×32) | 128×32 | ~30 KB |
coloX-4 | 240×240 | 4 | 1170 (30×30+30×9) | 128×128 | ~74 KB |
coloX-16 | 240×240 | 16 | 1170 (30×30+30×9) | 128×128 | ~184 KB |
Large Screen Specifications (454×454)
| Specification | Resolution | Color depth (bpp) | Sprites | Map dimensions | ROM limit |
|---|---|---|---|---|---|
coloX-4B | 454×454 | 4 | 3534 (57×57+57×5) | 128×128 | ~148 KB |
coloX-16B | 454×454 | 16 | 3534 (57×57+57×5) | 128×128 | ~479 KB |
coloX-32B | 454×454 | 32 | 3534 (57×57+57×5) | 128×128 | ~921 KB |
Extra-Large Screen Specifications (480×480)
| Specification | Resolution | Color depth (bpp) | Sprites | Map dimensions | ROM limit |
|---|---|---|---|---|---|
coloX-4C | 480×480 | 4 | 3900 (60×60+60×5) | 128×128 | ~159 KB |
coloX-16C | 480×480 | 16 | 3900 (60×60+60×5) | 128×128 | ~525 KB |
coloX-32C | 480×480 | 32 | 3900 (60×60+60×5) | 128×128 | ~1013 KB |
Tall Screen Specifications (480×800)
| Specification | Resolution | Color depth (bpp) | Sprites | Map dimensions | ROM limit |
|---|---|---|---|---|---|
coloX-4L | 480×800 | 4 | 6300 (60×100+60×5) | 128×128 | ~234 KB |
coloX-16L | 480×800 | 16 | 6300 (60×100+60×5) | 128×128 | ~825 KB |
coloX-32L | 480×800 | 32 | 6300 (60×100+60×5) | 128×128 | ~1613 KB |
Wide Screen Specifications (800×480)
| Specification | Resolution | Color depth (bpp) | Sprites | Map dimensions | ROM limit |
|---|---|---|---|---|---|
coloX-4W | 800×480 | 4 | 6500 (100×60+100×5) | 128×128 | ~241 KB |
coloX-16W | 800×480 | 16 | 6500 (100×60+100×5) | 128×128 | ~850 KB |
coloX-32W | 800×480 | 32 | 6500 (100×60+100×5) | 128×128 | ~1663 KB |
Specification Fields
| Field | Description |
|---|---|
| Resolution | Canvas dimensions in pixels (__vm_width × __vm_height) |
| Color depth | Bits per pixel: 4 = 16-color palette, 16 = RGB565, 32 = RGBA8888 |
| Sprites | Total number of 8×8 sprites the sprite sheet can hold |
| Map dimensions | Map grid dimensions in 8×8 tiles (width×height) |
| ROM limit | Approximate maximum binary size after compiling .clx |
Development Platforms
| Platform | Description |
|---|---|
| NatureMini | Linux development platform supporting multiple specifications with higher performance |
| ColoPLAY | Small embedded device, ESP32-S3, round screen, supporting up to coloX-16 |
| ColoPLAY V2 | Small embedded device, ESP32-S31, round touch screen without buttons, supporting up to coloX-16C |
3. Runtime Constants
The following global constants are automatically available at application startup:
Canvas and Display
| Constant | Description |
|---|---|
__vm_width | Canvas width (pixels) |
__vm_height | Canvas height (pixels) |
__vm_bpp | Canvas color depth (4/16/32) |
__vm_scr_width | Physical screen width |
__vm_scr_height | Physical screen height |
__vm_speed_lvl | Device speed level (0-100); higher values indicate higher performance |
__vm_auto_gen_rom | Whether this is a development build (true in development builds; undefined/nil on devices) |
Memory Addresses
| Constant | Description |
|---|---|
__vm_GFX | Sprite image data address |
__vm_MAP | Map data address |
__vm_FLAGS | Sprite flag data address |
__vm_MUSIC | Music data address |
__vm_SFX | Sound effect data address |
__vm_USERDATA | User data address |
__vm_CARTDATA | Application storage data mapping address |
__vm_VRAM | Video memory address (canvas) |
__vm_DRAWSTAT | Drawing state address |
__vm_HWSTAT | Hardware state address |
4. Color System
16-Color Palette (Default Colors in 4-bit Mode)
The following color constants are available in all color depth modes:
| Constant | RGB | Example |
|---|---|---|
black | #000000 | ■ |
dark_blue | #1D2B53 | ■ |
dark_purple | #7E2553 | ■ |
dark_green | #008751 | ■ |
brown | #AB5236 | ■ |
dark_gray | #5F574F | ■ |
light_gray | #C2C3C7 | ■ |
white | #FFF1E8 | ■ |
red | #FF004D | ■ |
orange | #FFA300 | ■ |
yellow | #FFEC27 | ■ |
green | #00E436 | ■ |
blue | #29ADFF | ■ |
indigo | #83769C | ■ |
pink | #FF77A8 | ■ |
peach | #FFCCAA | ■ |
16-bit / 32-bit Colors
In 16-bit (RGB565) and 32-bit (RGBA8888) modes, colors are not limited to the 16-color palette. Use getcolor() or palrgb() to obtain color values accepted by drawing functions:
-- Create colors directly from RGB in 16/32-bit mode
local my_red = getcolor(0xff, 0x40, 0x20)
circfill(120, 120, 50, my_red)
-- Set a palette entry and get its color value
local custom = palrgb(0, 200, 180, 255)
rectfill(10, 10, 100, 100, custom)