ColorPalette#

class tollan.plot.plotly.ColorPalette(name: str = 'Dark24')[source]#

Bases: object

A class to manage colors from a named palette.

Attributes Summary

colors

Tuple of hex color codes in the palette.

name

Methods Summary

cycle([scale])

Create an infinite iterator cycling through colors.

cycle_alternated(*scales)

Create iterator alternating between colors at different scales.

cycles(*scales)

Create iterator cycling through color tuples at different scales.

get_scaled(scale)

Get colors scaled by blending with white.

Attributes Documentation

colors#

Tuple of hex color codes in the palette.

Returns:

Original colors from the palette.

Return type:

tuple[str, …]

name: str = 'Dark24'#

Methods Documentation

cycle(scale: float = 1) Iterator[str][source]#

Create an infinite iterator cycling through colors.

Parameters:

scale (float, default 1.0) – Scaling factor for colors (see get_scaled).

Returns:

Infinite iterator of hex color codes.

Return type:

Iterator[str]

cycle_alternated(*scales: float) Iterator[str][source]#

Create iterator alternating between colors at different scales.

Parameters:

*scales (float) – Multiple scaling factors.

Returns:

Iterator alternating through colors: scale1_color1, scale2_color1, scale1_color2, scale2_color2, …

Return type:

Iterator[str]

cycles(*scales: float) Iterator[tuple[str, ...]][source]#

Create iterator cycling through color tuples at different scales.

Parameters:

*scales (float) – Multiple scaling factors.

Returns:

Iterator of color tuples, one color per scale.

Return type:

Iterator[tuple[str, …]]

get_scaled(scale: float) tuple[str, ...][source]#

Get colors scaled by blending with white.

Parameters:

scale (float) – Scaling factor. 1.0 returns original colors, values < 1.0 blend colors towards white.

Returns:

Tuple of hex color codes.

Return type:

tuple[str, …]