color

Colors and utility functions for conversion between different color models.

Classes

Colors

A list of pre-defined colors.

Functions

average_color(*colors)[source]
Parameters

colors (colour.Color) –

Return type

colour.Color

color_gradient(reference_colors, length_of_output)[source]
Parameters
  • reference_colors (Iterable[colour.Color]) –

  • length_of_output (int) –

Return type

List[colour.Color]

color_to_int_rgb(color)[source]
Parameters

color (colour.Color) –

Return type

numpy.ndarray

color_to_int_rgba(color, opacity=1.0)[source]
Parameters
  • color (colour.Color) –

  • opacity (float) –

Return type

numpy.ndarray

color_to_rgb(color)[source]
Parameters

color (Union[colour.Color, str]) –

Return type

numpy.ndarray

color_to_rgba(color, alpha=1)[source]
Parameters
  • color (Union[colour.Color, str]) –

  • alpha (float) –

Return type

numpy.ndarray

get_shaded_rgb(rgb, point, unit_normal_vect, light_source)[source]
Parameters
  • rgb (numpy.ndarray) –

  • point (numpy.ndarray) –

  • unit_normal_vect (numpy.ndarray) –

  • light_source (numpy.ndarray) –

Return type

numpy.ndarray

hex_to_rgb(hex_code)[source]
Parameters

hex_code (str) –

Return type

numpy.ndarray

interpolate_color(color1, color2, alpha)[source]
Parameters
  • color1 (colour.Color) –

  • color2 (colour.Color) –

  • alpha (float) –

Return type

colour.Color

invert_color(color)[source]
Parameters

color (colour.Color) –

Return type

colour.Color

random_bright_color()[source]
Return type

colour.Color

random_color()[source]
Return type

colour.Color

rgb_to_color(rgb)[source]
Parameters

rgb (Iterable[float]) –

Return type

colour.Color

rgb_to_hex(rgb)[source]
Parameters

rgb (Iterable[float]) –

Return type

str

rgba_to_color(rgba)[source]
Parameters

rgba (Iterable[float]) –

Return type

colour.Color