PICO-8 Palette and Pixel Mapping Algorithm

2025-09-11

This code defines the 16-color palette of the PICO-8 game console and provides several color distance calculation methods (Euclidean distance, weighted RGB distance, HyAB distance and its variants), along with a function that maps image pixels to the closest palette color. It leverages NumPy for efficient color data handling and allows users to customize the distance function for different color matching strategies. This is highly useful for pixel art game development and image color quantization.

Game