palettes.wheel
HSV and RGB color-wheel palettes.
Build a smooth color wheel or fixed-saturation HSV ramp. Named Windows
16-color attributes (RED, BLACK, etc.) are available on each
instance.
Example
>>> from palettes import get_palette
>>> palette = get_palette(name="wheel", length=256, saturation=1.0)
>>> palette[0]
>>> palette.RED
- class palettes.wheel.WheelPalette(name='', color_depth=16, swapped=False, cached=True, length=256, saturation=1.0, value=None)[source]
Bases:
PaletteColor wheel or HSV ramp palette.
This is a good fit for animated gradients, rainbow effects, and other continuous color ramps. The default wheel mode produces a smooth cycling palette that can be sampled across a strip or a full-screen gradient. When either
saturationorvalueis set, indices map linearly through hue at a fixed saturation and brightness for more controlled ramps.- Parameters:
swapped (bool) – Byte-swap 16-bit colors when
True.cached (bool) – Memoize index lookups when
True(default).length (int) – Number of colors in the wheel (default
256).saturation (float) – HSV saturation in
0.0–1.0, orNonefor classic wheel mode.value (float) – HSV value in
0.0–1.0, orNonefor classic wheel mode.
- Raises:
ValueError – If
saturationorvalueis outside0–1in HSV mode.