Colors

Specify the colors that displayed objects use.

Color

class creator_studio_doc_format.core.Color(*, preset_identifier='', rgba=None, **extra_data)[source]

A color that the reader uses as part of a displayed object, in one of the forms the format supports.

Every form resolves to a color that can be displayed, so a reader never has to handle one that can’t be.

field rgba : RGBA | None = None

A color given as red, green, blue, and alpha components in a named RGB color space, together with an HDR headroom value.

RGBA

class creator_studio_doc_format.core.RGBA(*, preset_identifier='', red=0, green=0, blue=0, alpha=1, color_space=ColorSpace.SRGB, headroom=1, **extra_data)[source]

A color in an RGB-component color space, together with its alpha and an HDR headroom value.

field red : float = 0

The red component, in the range 0 to 1, expressed in the color space named by color_space.

Constraints:
  • ge = 0

  • le = 1

field green : float = 0

The green component, in the range 0 to 1, expressed in the color space named by color_space.

Constraints:
  • ge = 0

  • le = 1

field blue : float = 0

The blue component, in the range 0 to 1, expressed in the color space named by color_space.

Constraints:
  • ge = 0

  • le = 1

field alpha : float = 1

The alpha (opacity) component, in the range 0 to 1, where 0 is fully transparent and 1 is fully opaque.

Constraints:
  • ge = 0

  • le = 1

field color_space : ColorSpace = ColorSpace.SRGB

The RGB color space that the red, green, and blue components are expressed in.

field headroom : float = 1

The color’s own HDR headroom: how many times brighter than standard dynamic range (SDR) white it reaches. A value of 1 means an ordinary SDR color; red, green, and blue always describe its SDR appearance. If HDR can’t be reproduced, this value is ignored and those components can be used unchanged.

Constraints:
  • ge = 1

  • le = 16

ColorSpace

class creator_studio_doc_format.core.ColorSpace(str, Enum)[source]

The RGB primaries, white point, and transfer function used to map a color’s red, green, and blue values to a display.

The same three numbers denote a different color in each space. Where p3 can’t be reproduced, the components are used unchanged as srgb, which renders a less saturated version of the intended color rather than failing.

A field accepts a member or its value, so ColorSpace.P3 and 'p3' are the same. The member’s name as a string isn’t accepted.

P3 = 'p3'

Display P3 color space, with a nonlinear transfer function and D65 white point.

SRGB = 'srgb'

Standard RGB color space, with a nonlinear transfer function and D65 white point, as defined by IEC 61966-2-1.