Gdk.ColorState

Fields

None

Methods

class

get_oklab ()

class

get_oklch ()

class

get_rec2100_linear ()

class

get_rec2100_pq ()

class

get_srgb ()

class

get_srgb_linear ()

create_cicp_params ()

equal (other)

ref ()

unref ()

Details

class Gdk.ColorState

A GdkColorState object provides the information to interpret colors and pixels in a variety of ways.

They are also known as *color spaces*.

Crucially, GTK knows how to convert colors from one color state to another.

GdkColorState objects are immutable and therefore threadsafe.

New in version 4.16.

classmethod get_oklab()[source]
Returns:

the color state object for oklab

Return type:

Gdk.ColorState

Returns the color state object representing the oklab color space.

This is a perceptually uniform color state.

New in version 4.18.

classmethod get_oklch()[source]
Returns:

the color state object for oklch

Return type:

Gdk.ColorState

Returns the color state object representing the oklch color space.

This is the polar variant of oklab, in which the hue is encoded as a polar coordinate.

New in version 4.18.

classmethod get_rec2100_linear()[source]
Returns:

the color state object for linearized rec2100

Return type:

Gdk.ColorState

Returns the color state object representing the linear rec2100 color space.

This color state uses the primaries defined by BT.2020-2 and BT.2100-0 and a linear transfer function.

It is equivalent to the Cicp tuple 9/8/0/1.

See e.g. the CSS HDR Module for details about this colorstate.

New in version 4.16.

classmethod get_rec2100_pq()[source]
Returns:

the color state object for rec2100-pq

Return type:

Gdk.ColorState

Returns the color state object representing the rec2100-pq color space.

This color state uses the primaries defined by BT.2020-2 and BT.2100-0 and the transfer function defined by SMPTE ST 2084 and BT.2100-2.

It is equivalent to the Cicp tuple 9/16/0/1.

See e.g. the CSS HDR Module for details about this colorstate.

New in version 4.16.

classmethod get_srgb()[source]
Returns:

the color state object for sRGB

Return type:

Gdk.ColorState

Returns the color state object representing the sRGB color space.

This color state uses the primaries defined by BT.709-6 and the transfer function defined by IEC 61966-2-1.

It is equivalent to the Cicp tuple 1/13/0/1.

See e.g. the CSS Color Module for details about this colorstate.

New in version 4.16.

classmethod get_srgb_linear()[source]
Returns:

the color state object for linearized sRGB

Return type:

Gdk.ColorState

Returns the color state object representing the linearized sRGB color space.

This color state uses the primaries defined by BT.709-6 and a linear transfer function.

It is equivalent to the Cicp tuple 1/8/0/1.

See e.g. the CSS Color Module for details about this colorstate.

New in version 4.16.

create_cicp_params()[source]
Returns:

A new [class`Gdk`.CicpParams]

Return type:

Gdk.CicpParams or None

Create a [class`Gdk`.CicpParams] representing the colorstate.

It is not guaranteed that every GdkColorState can be represented with Cicp parameters. If that is the case, this function returns NULL.

New in version 4.16.

equal(other)[source]
Parameters:

other (Gdk.ColorState) – another GdkColorStatee

Returns:

True if the two color states compare equal

Return type:

bool

Compares two GdkColorStates for equality.

Note that this function is not guaranteed to be perfect and two objects describing the same color state may compare not equal. However, different color states will never compare equal.

New in version 4.16.

ref()[source]
Returns:

the object that was passed in

Return type:

Gdk.ColorState

Increase the reference count of self.

New in version 4.16.

unref()[source]

Decrease the reference count of self.

Unless self is static, it will be freed when the reference count reaches zero.

New in version 4.16.