dylanebert's picture
initial commit
346b70f

A newer version of the Gradio SDK is available: 6.4.0

Upgrade

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