SBPaletteSequentialHCL#
This class is a base class for sequential HCL color palettes.
A sequential palette is constructed in a 3D color coordinate space with coordinates named hue
, chroma
, and luminance
, that are computed as follows:
hue = hue1 + i * (hue2 - hue1)
if
Cmax < chroma1
ormaximumChroma < chroma2
thenchroma
is computed based on a “linear” trajectoryc = chroma1 + i^(chromaPower) * (chroma2 - chroma1)
(see samson.SBPalette.getValueAlongLinearTrajectory), else it is computed based on the triangular trajectory (see samson.SBPalette.getValueAlongTriangularTrajectory)luminance = luminance1 + i^(luminancePower) * (luminance2 - luminance1)
Here i
is a value (of intensity) based on which the colorization should be done.
# Single-hue sequential HCL palette - Green
palette1 = SBPaletteSequentialHCL(
hue1 = 135, hue2 = 135,
chroma1 = 45, maximumChroma = 0, chroma2 = 45,
luminance1 = 35, luminance2 = 95,
chromaPower = 1.0,
luminancePower = 1.3,
name = "Sequential: Green")
# Multi-hue sequential HCL palette - Viridis
palette2 = SBPaletteSequentialHCL(
hue1 = 300, hue2 = 75,
chroma1 = 40, maximumChroma = 0, chroma2 = 95,
luminance1 = 15, luminance2 = 90,
chromaPower = 1.0,
luminancePower = 1.1,
name = "Sequential: Viridis")
# Multi-hue sequential HCL palette - Teal
palette3 = SBPaletteSequentialHCL(
hue1 = 240, hue2 = 180,
chroma1 = 35, maximumChroma = 40, chroma2 = 15,
luminance1 = 35, luminance2 = 92,
chromaPower = 0.6,
luminancePower = 1.1,
name = "Sequential: Teal")
Note
You can find available default palettes in samson.SBPaletteDefaultPalette
.
- class samson.SBPaletteSequentialHCL(*args, **kwargs)#
Bases:
SBPaletteSequential
This class is a base class for the sequential HCL (Hue-Chroma-Luminance) color palette.
Overloaded function.
__init__(self: samson.SBPaletteSequentialHCL) -> None
Default constructor
__init__(self: samson.SBPaletteSequentialHCL, hue1: int, hue2: int, chroma1: int = 50, maximumChroma: int = 50, chroma2: int = 50, luminance1: int = 70, luminance2: int = 70, chromaPower: float = 1.0, luminancePower: float = 1.0, name: str = ‘’, reverse: bool = False) -> None
Constructs a sequential HCL color palette with the given parameters.
- Parameters:
hue1 (int) – The left-side hue
hue2 (int) – The right-side hue
chroma1 (int, default=50) – The left-side chroma
maximumChroma (int, default=50) – The maximum chroma
chroma2 (int, default=50) – The right-side chroma
luminance1 (int, default=70) – The left-side luminance
luminance2 (int, default=70) – The right-side luminance
chromaPower (float, default=1.0) – The chroma power
luminancePower (float, default=1.0) – The luminance power
name (str, default='') – A palette name
reverse (bool, default=False) – The reverse flag - whether the color palette is mirrored or not.
Examples
>>> palette = SBPaletteSequentialHCL(hue1 = 60, hue2 = 270, chroma1 = 60, maximumChroma = 60, chroma2 = 60, luminance1 = 80, luminance2 = 80)
__init__(self: samson.SBPaletteSequentialHCL, palette: samson.SBPaletteSequentialHCL) -> None
Constructs a sequential HCL color palette based on the given sequential HCL color palette
- Parameters:
palette (samson.SBPaletteSequential) – Another sequential HCL color palette