mitk.ColorProperty#

class mitk.ColorProperty#

Bases: BaseProperty

Property holding an RGB color.

When read through the high-level property API the value is coerced to an (r, g, b) tuple of floats in [0, 1].

__init__(self: mitk.ColorProperty, value: mitk.Color) None#

Construct a color property from a Color.

Parameters:

value – The color value.

Methods

__init__(self, value)

Construct a color property from a Color.

clone(self)

Return a deep copy of this property.

from_json(json)

Reconstruct a BaseProperty subclass from JSON.

from_rgb(arg0, arg1, arg2)

Construct a color property from three floats.

to_json(self)

Serialize this property to a self-contained JSON string.

Attributes

value

The stored Color.

__eq__(self: mitk.BaseProperty, arg0: mitk.BaseProperty) bool#
clone(self: mitk.BaseProperty) mitk.BaseProperty#

Return a deep copy of this property.

static from_json(json: str) mitk.BaseProperty#

Reconstruct a BaseProperty subclass from JSON.

Parameters:

json – JSON string produced by to_json().

Returns:

A new BaseProperty of the appropriate subclass.

static from_rgb(arg0: SupportsFloat, arg1: SupportsFloat, arg2: SupportsFloat) mitk.ColorProperty#

Construct a color property from three floats.

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

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

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

Returns:

A new ColorProperty.

to_json(self: mitk.BaseProperty) str#

Serialize this property to a self-contained JSON string.

The string carries enough type information that from_json() can reconstruct the correct subclass.

Returns:

JSON string representation of the property.

property value#

The stored Color.