mitk.Color#

class mitk.Color#

Bases: pybind11_object

RGB color with three float components in the closed range [0, 1].

Indexable and iterable (length 3), so it interoperates naturally with tuple, list, and unpacking:

Examples

>>> c = mitk.Color(1.0, 0.5, 0.0)
>>> r, g, b = c
>>> tuple(c)
(1.0, 0.5, 0.0)
__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: mitk.Color) -> None

Construct a black color (0, 0, 0).

  1. __init__(self: mitk.Color, r: typing.SupportsFloat, g: typing.SupportsFloat, b: typing.SupportsFloat) -> None

Construct an RGB color.

Parameters:
  • r – Red component in [0, 1].

  • g – Green component in [0, 1].

  • b – Blue component in [0, 1].

Methods

__init__(*args, **kwargs)

Overloaded function.

Attributes

b

Blue component in [0, 1].

g

Green component in [0, 1].

r

Red component in [0, 1].

__eq__(self: mitk.Color, arg0: mitk.Color) bool#
__getitem__(self: mitk.Color, arg0: SupportsInt) float#

Return the i-th component (0 = red, 1 = green, 2 = blue).

__iter__(self: mitk.Color) collections.abc.Iterator#

Iterate over the (r, g, b) components.

__len__(self: mitk.Color) int#

Number of components (always 3).

__setitem__(self: mitk.Color, arg0: SupportsInt, arg1: SupportsFloat) None#

Set the i-th component.

property b#

Blue component in [0, 1].

property g#

Green component in [0, 1].

property r#

Red component in [0, 1].