8bitlenser/lenser/c128/palette.py
2026-07-03 19:35:35 -07:00

38 lines
1.1 KiB
Python

"""Commodore 128 VDC (8563) 16-colour RGBI palette.
The VDC outputs digital RGBI, giving a CGA-like 16-colour set (quite different
from the VIC-II's colours). Index 0 = black, 15 = white -- the only two the mono
mode needs; the rest are provided for tinted-mono and future colour modes.
"""
from __future__ import annotations
import numpy as np
from ..palette import srgb_to_lab
VDC = np.array([
(0x00, 0x00, 0x00), # 0 black
(0x55, 0x55, 0x55), # 1 dark grey
(0x00, 0x00, 0xAA), # 2 blue
(0x55, 0x55, 0xFF), # 3 light blue
(0x00, 0xAA, 0x00), # 4 green
(0x55, 0xFF, 0x55), # 5 light green
(0x00, 0xAA, 0xAA), # 6 cyan
(0x55, 0xFF, 0xFF), # 7 light cyan
(0xAA, 0x00, 0x00), # 8 red
(0xFF, 0x55, 0x55), # 9 light red
(0xAA, 0x00, 0xAA), # 10 purple
(0xFF, 0x55, 0xFF), # 11 light purple
(0xAA, 0x55, 0x00), # 12 brown
(0xFF, 0xFF, 0x55), # 13 light yellow
(0xAA, 0xAA, 0xAA), # 14 light grey
(0xFF, 0xFF, 0xFF), # 15 white
], dtype=np.float64)
def get_palette() -> np.ndarray:
return VDC
def palette_lab() -> np.ndarray:
return srgb_to_lab(VDC)