Default Palettes

Diverging HCL palettes

Usage information: the names of the palettes can be used to retrieve a set of colors by calling:

Function Reference

class palettes.diverging_hcl(h = [260, 0], c = 80, l = [30, 90], power = 1.5, fixup = True, palette = None, rev = False, *args, **kwargs)[source]

Diverging HCL color palette.

Parameters:
  • h (numeric list) – hue values, diverging color palettes should have different hues for both ends of the palette. If only one value is present it will be recycled ending up in a diverging color palette with the same colors on both ends. If more than two values are provided the first two will be used while the rest is ignored. If input h is a string this argument acts like the palette argument (see palette input parameter).
  • c (numeric) – chroma value, a single numeric value. If multiple values are provided only the first one will be used.
  • l (numeric list) – luminance values. The first value is for the two ends of the color palette, the second one for the neutral center point. If only one value is given this value will be recycled.
  • power (numeric) – power parameter for non-linear behaviour of the color palette.
  • fixup (bool) – only used when converting the HCL colors to hex. Should RGB values outside the defined RGB color space be corrected?
  • palette (string) – can be used to load a default diverging color palette specification. If the palette does not exist an exception will be raised. Else the settings of the palette as defined will be used to create the color palette.
  • rev (bool) – should the color map be reversed.
  • args – unused.
  • kwargs – Additional arguments to overwrite the h/c/l settings. @TODO has to be documented.
Returns:

  • Initialize new object, no return. Raises a set of errors if the parameters
  • are misspecified. Note that the object is callable, the default object call
  • can be used to return hex colors (identical to the .colors() method),
  • see examples.

Examples

>>> from colorspace import diverging_hcl
>>> a = diverging_hcl()
>>> a.colors(10)
>>> b = diverging_hcl("Blue-Yellow 3")
>>> b.colors(10)
>>> # The standard call of the object also returns hex colors. Thus,
>>> # you can make your code slimmer by calling:
>>> diverging_hcl("Dynamic")(10)
colors(n = 11, type_ = "hex", fixup = None)[source]

Returns the colors of the current color palette.

Parameters:
  • n (int) – number of colors which should be returned.
  • fixup (None, bool) – should sRGB colors be corrected if they lie outside the defined color space? If None the fixup parameter from the object will be used. Can be set to True or False to explicitly control the fixup here.
  • alpha (None, float) – float (single value) or vector of floats in the range of [0.,1.] for alpha transparency channel (0. means full transparency, 1. opaque). If a single value is provided it will be applied to all colors, if a vector is given the length has to be n.

Sequential

  • colorspace.sequential_hcl(n = 10, name = "<palette name>")

Function Reference

class palettes.sequential_hcl(h = 260, c = [80, 30], l = [30, 90], power = 1.5, fixup = True, palette = None, rev = False, *args, **kwargs)[source]

Sequential HCL color palette.

Parameters:
  • h (numeric) – hue values. If only one value is given the value is recycled which yields a single-hue sequential color palette. If input h is a string this argument acts like the palette argument (see palette input parameter).
  • c (numeric list) – chroma values, numeric of length two. If multiple values are provided only the first one will be used.
  • l (numeric list) – luminance values, numeric of length two. If multiple values are provided only the first one will be used.
  • power (numeric, numeric list) – power parameter for non-linear behaviour of the color palette. One or two values can be provided.
  • fixup (bool) – only used when converting the HCL colors to hex. Should RGB values outside the defined RGB color space be corrected?
  • palette (string) – can be used to load a default diverging color palette specification. If the palette does not exist an exception will be raised. Else the settings of the palette as defined will be used to create the color palette.
  • rev (bool) – should the color map be reversed.
  • args – unused.
  • kwargs – Additional arguments to overwrite the h/c/l settings. @TODO has to be documented.
Returns:

  • Initialize new object, no return. Raises a set of errors if the parameters
  • are misspecified. Note that the object is callable, the default object call
  • can be used to return hex colors (identical to the .colors() method),
  • see examples.

Examples

>>> from colorspace import sequential_hcl
>>> a = sequential_hcl()
>>> a.colors(10)
>>> b = sequential_hcl("Reds")
>>> b.colors(10)
>>> # The standard call of the object also returns hex colors. Thus,
>>> # you can make your code slimmer by calling:
>>> sequential_hcl("Dynamic")(10)
colors(n = 11, type_ = "hex", fixup = None)[source]

Returns the colors of the current color palette.

Parameters:
  • n (int) – number of colors which should be returned.
  • fixup (None, bool) – should sRGB colors be corrected if they lie outside the defined color space? If None the fixup parameter from the object will be used. Can be set to True or False to explicitly control the fixup here.

Qualitative

Function Reference

class palettes.qualitative_hcl(h = [0, 360.], c = 50, l = 70, fixup = True, palette = None, rev = False, **kwargs)[source]

Qualitative HCL color palette.

Parameters:
  • h (numeric list) – hue values, qualitative color palettes require two hues. If more than two values are provided the first two will be used while the rest is ignored. If input h is a string this argument acts like the palette argument (see palette input parameter).
  • c (numeric) – chroma value, a single numeric value. If multiple values are provided only the first one will be used.
  • l (numeric) – luminance value, a single numeric value. If multiple values are provided only the first one will be used.
  • fixup (bool) – only used when converting the HCL colors to hex. Should RGB values outside the defined RGB color space be corrected?
  • palette (None, string) – can be used to load a default diverging color palette specification. If the palette does not exist an exception will be raised. Else the settings of the palette as defined will be used to create the color palette.
  • rev (bool) – should the color map be reversed.
  • args – unused.
  • kwargs – Additional arguments to overwrite the h/c/l settings. @TODO has to be documented.
Returns:

  • Initialize new object, no return. Raises a set of errors if the parameters
  • are misspecified. Note that the object is callable, the default object call
  • can be used to return hex colors (identical to the .colors() method),
  • see examples.

Examples

>>> from colorspace import diverging_hcl
>>> a = qualitative_hcl()
>>> a.colors(10)
>>> b = qualitative_hcl("Dynamic")
>>> b.colors(10)
>>> # The standard call of the object also returns hex colors. Thus,
>>> # you can make your code slimmer by calling:
>>> qualitative_hcl("Dynamic")(10)
colors(n = 11, type_ = "hex", fixup = None)[source]

Returns the colors of the current color palette.

Parameters:
  • n (int) – number of colors which should be returned.
  • fixup (None, bool) – should sRGB colors be corrected if they lie outside the defined color space? If None the fixup parameter from the object will be used. Can be set to True or False to explicitly control the fixup here.