#!/usr/bin/env python3 # SPDX-License-Identifier: MIT """The reference's window palettes and composite option, in ``a7800-play --dump-palettes``'s format, for the ladder to compare byte for byte (a7800-python's ``frontend.py`` at d6b220d, from the clone at ``external/a7800-python``; pygame is not needed for these functions). .venv-pypy/bin/python scripts/palettes_ref.py """ from __future__ import annotations import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "external" / "a7800-python" / "src")) from a7800_python import frontend # noqa: E402 for kind in frontend.PALETTES: print(kind, " ".join(f"{r:02x}{g:02x}{b:02x}" for r, g, b in frontend.palette(kind))) row = bytes((x * 37) & 0xFF for x in range(320)) for kind in ("warm", "hot"): print(f"composite-{kind}", frontend.render([row], kind, True).hex()) u, v = frontend.chroma(0x35, 26.7) print(f"chroma {u:.17f} {v:.17f}")