Color#

class blueprints.Color[source]#

Bases: ColorType

The color descriptor can be one of the following:

  • string containing the colors name: 'orange'

  • string containing the colors hex code as RGB: '#FFFF00'

  • string containing the colors hex code as RGBA: '#FFFF0080'

  • integer specifying the colors hex code as RGB 0xFFFF00

  • list containing the colors components as RGB: [1, 1, 0]

  • list containing the colors components as RGBA: [1, 1, 0, 0.5]

  • np.array containing the colors components as RGB: [1, 1, 0]

  • np.array containing the colors components as RGBA: [1, 1, 0, 0.5]

  • Color object.

Attributes Summary

blue

The value is synchronized with rgb and rgba.

green

The value is synchronized with rgb and rgba.

name

The name is set to be the closest name among default colors.

opacity

The value is synchronized with rgba.

red

The value is synchronized with rgb and rgba.

rgb

The values are synchronized with rgba, red,:attr:green and blue .

rgba

The values are synchronized with rgb, red,:attr:green, blue and opacity.

Attributes Documentation

blue#

The value is synchronized with rgb and rgba.

Returns:

The blue component of the color array.

Return type:

float | None

green#

The value is synchronized with rgb and rgba.

Returns:

The green component of the color array.

Return type:

float | None

name#

The name is set to be the closest name among default colors.

Return type:

str

opacity#

The value is synchronized with rgba.

Returns:

The opacity component of the color array.

Return type:

int | float

red#

The value is synchronized with rgb and rgba.

Returns:

The red component of the color array.

Return type:

float | None

rgb#

The values are synchronized with rgba, red,:attr:green and blue .

Returns:

The color array without opacity.

Return type:

np.ndarray

rgba#

The values are synchronized with rgb, red,:attr:green, blue and opacity.

Returns:

The color array with opacity.

Return type:

np.ndarray

__init__(descriptor, opacity=None)[source]#
Parameters:
  • descriptor (str | int | list[int | float] | ndarray | ColorType)

  • opacity (int | float | None)

classmethod __new__(*args, **kwargs)#