# Palette Module Color quantization and palette generation ## Purpose - Quantize colors to fixed palettes - Map arbitrary colors to palette entries - Perform color space conversions ## Layout ``` palette/ ├── context.md # This file ├── __init__.py # API: create_palette() ├── quantizer.py # K-means clustering ├── mapper.py # Color-to-palette mapping └── color_space.py # RGB/LAB conversions ``` ## Scope - In-scope: Color quantization, LAB space clustering, nearest neighbor mapping - Out-of-scope: Image processing, texture generation ## Entrypoints - `create_palette(colors, size)` - Generate palette - `PaletteMapper(palette)` - Map colors to palette - `quantize_colors(colors, n_colors)` - K-means quantization ## Dependencies - Internal: color_space - External: NumPy, scikit-learn, SciPy