First public commit.
This commit is contained in:
parent
2a48f52979
commit
4bac9d83ed
288 changed files with 18417 additions and 1076 deletions
39
lenser/ti99/palette.py
Normal file
39
lenser/ti99/palette.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
"""TI-99/4A TMS9918A Video Display Processor palette (15 colours + transparent)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import numpy as np
|
||||
|
||||
from ..palette import srgb_to_lab
|
||||
|
||||
# TMS9918A colours, index 0 = transparent (we never use it for pixels).
|
||||
# Common measured RGB values.
|
||||
TMS9918 = np.array([
|
||||
(0x00, 0x00, 0x00), # 0 transparent (treated as black for matching)
|
||||
(0x00, 0x00, 0x00), # 1 black
|
||||
(0x21, 0xc8, 0x42), # 2 medium green
|
||||
(0x5e, 0xdc, 0x78), # 3 light green
|
||||
(0x54, 0x55, 0xed), # 4 dark blue
|
||||
(0x7d, 0x76, 0xfc), # 5 light blue
|
||||
(0xd4, 0x52, 0x4d), # 6 dark red
|
||||
(0x42, 0xeb, 0xf5), # 7 cyan
|
||||
(0xfc, 0x55, 0x54), # 8 medium red
|
||||
(0xff, 0x79, 0x78), # 9 light red
|
||||
(0xd4, 0xc1, 0x54), # 10 dark yellow
|
||||
(0xe6, 0xce, 0x80), # 11 light yellow
|
||||
(0x21, 0xb0, 0x3b), # 12 dark green
|
||||
(0xc9, 0x5b, 0xba), # 13 magenta
|
||||
(0xcc, 0xcc, 0xcc), # 14 grey
|
||||
(0xff, 0xff, 0xff), # 15 white
|
||||
], dtype=np.float64)
|
||||
|
||||
# Palette indices usable as pixel colours (1..15).
|
||||
USABLE = list(range(1, 16))
|
||||
|
||||
|
||||
def get_palette() -> np.ndarray:
|
||||
return TMS9918
|
||||
|
||||
|
||||
def palette_lab() -> np.ndarray:
|
||||
return srgb_to_lab(TMS9918)
|
||||
Loading…
Add table
Add a link
Reference in a new issue