deephaven.plot.color

This module implements the Color class and provides a list of predefined colors that can be used to paint a plot.

class Color(j_color)[source]

Bases: JObjectWrapper

A color.

j_object_type

alias of Color

static of_hsl(h, s, l, alpha=1.0)[source]

Creates a Color with the specified hue, saturation, lightness, and alpha. The lower the alpha, the more transparent the color.

Parameters:
  • h (float) – the hue component, as a degree on the color wheel in the range (0.0 - 360.0)

  • s (float) – the saturation component, as a percentage in the range (1.0 - 100.0)

  • l (float) – the lightness component, as a percentage in the range (1.0 - 100.0)

  • alpha (float, optional) – the alpha component in the range (0.0 - 1.0), default is 1.0. Lower alpha means more transparent for the color.

Return type:

Color

Returns:

a Color

Raises:

DHError

static of_name(name)[source]

Creates a Color instance represented by the name string.

Colors are specified by name or hex value. Hex values are parsed as follows: first two digits set the Red component of the color; second two digits set the Green component; third two the Blue. Hex values must have a “#” in front, e.g. “#001122”

Parameters:

name (str) – the name of the color

Return type:

Color

Returns:

a Color

Raises:

DHError

static of_rgb(r, g, b, alpha=255)[source]

Creates a Color with the specified red, green, blue, and alpha values.

Parameters:
  • r (int) – the red component in the range (0 - 255)

  • g (int) – the green component in the range (0 - 255)

  • b (int) – the blue component in the range (0 - 255)

  • alpha (int, optional) – the alpha component in the range (0 - 255), default is 255. Lower alpha means more transparent for the color.

Return type:

Color

Returns:

a Color

Raises:

DHError

static of_rgb_f(r, g, b, alpha=1.0)[source]

Creates a Color with the specified red, green, blue, and alpha values expressed in floating numbers.

Parameters:
  • r (float) – the red component in the range (0.0 - 1.0)

  • g (float) – the green component in the range (0.0 - 1.0)

  • b (float) – the blue component in the range (0.0 - 1.0)

  • alpha (float, optional) – the alpha component in the range (0.0 - 1.0), default is 1.0. Lower alpha means more transparent for the color.

Return type:

Color

Returns:

a color

Raises:

DHError

class Colors[source]

Bases: object

The Colors class provides a namespace for all the predefined colors.