Summary
Add a colorsys module for converting between color systems (RGB, HSV, HLS, YIQ), matching Python's colorsys module API. Pure math, no dependencies.
Proposed Sharpy API
import colorsys
h, s, v = colorsys.rgb_to_hsv(0.2, 0.4, 0.6)
r, g, b = colorsys.hsv_to_rgb(h, s, v)
h, l, s = colorsys.rgb_to_hls(0.2, 0.4, 0.6)
r, g, b = colorsys.hls_to_rgb(h, l, s)
y, i, q = colorsys.rgb_to_yiq(0.2, 0.4, 0.6)
r, g, b = colorsys.yiq_to_rgb(y, i, q)
Key Decisions
- All values are floats in [0.0, 1.0] range (matching Python)
- Hue is in [0.0, 1.0] (not degrees — matching Python)
- Pure functions, no classes needed
- Smallest possible module — 6 functions, ~100 lines
- Match Python's exact formulas for bit-perfect compatibility
Test Plan
Summary
Add a
colorsysmodule for converting between color systems (RGB, HSV, HLS, YIQ), matching Python'scolorsysmodule API. Pure math, no dependencies.Proposed Sharpy API
Key Decisions
Test Plan