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: Palette

Color 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 saturation or value is set, indices map linearly through hue at a fixed saturation and brightness for more controlled ramps.

Parameters:
  • name (str) – Prefix for name (length suffix is added).

  • color_depth (int) – Output format; see Palette.

  • 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, or None for classic wheel mode.

  • value (float) – HSV value in 0.0–1.0, or None for classic wheel mode.

Raises:

ValueError – If saturation or value is outside 0–1 in HSV mode.