Gtk.SymbolicColor

Fields

None

Methods

class

new_alpha (color, factor)

class

new_literal (color)

class

new_mix (color1, color2, factor)

class

new_name (name)

class

new_shade (color, factor)

class

new_win32 (theme_class, id)

ref ()

resolve (props)

to_string ()

unref ()

Details

class Gtk.SymbolicColor

Gtk.SymbolicColor is a boxed type that represents a symbolic color. It is the result of parsing a ‘color expression [gtkcssprovider-symbolic-colors]’. To obtain the color represented by a Gtk.SymbolicColor, it has to be resolved with Gtk.SymbolicColor.resolve(), which replaces all symbolic color references by the colors they refer to (in a given context) and evaluates mix, shade and other expressions, resulting in a Gdk.RGBA value.

It is not normally necessary to deal directly with Gtk.SymbolicColors, since they are mostly used behind the scenes by Gtk.StyleContext and Gtk.CssProvider.

Gtk.SymbolicColor is deprecated. Symbolic colors are considered an implementation detail of GTK+.

classmethod new_alpha(color, factor)[source]
Parameters:
Returns:

A newly created Gtk.SymbolicColor

Return type:

Gtk.SymbolicColor

Creates a symbolic color by modifying the relative alpha value of color. A factor < 1.0 would resolve to a more transparent color, while > 1.0 would resolve to a more opaque color.

New in version 3.0.

Deprecated since version 3.8: Gtk.SymbolicColor is deprecated.

classmethod new_literal(color)[source]
Parameters:

color (Gdk.RGBA) – a Gdk.RGBA

Returns:

a newly created Gtk.SymbolicColor

Return type:

Gtk.SymbolicColor

Creates a symbolic color pointing to a literal color.

New in version 3.0.

Deprecated since version 3.8: Gtk.SymbolicColor is deprecated.

classmethod new_mix(color1, color2, factor)[source]
Parameters:
Returns:

A newly created Gtk.SymbolicColor

Return type:

Gtk.SymbolicColor

Creates a symbolic color defined as a mix of another two colors. a mix factor of 0 would resolve to color1, while a factor of 1 would resolve to color2.

New in version 3.0.

Deprecated since version 3.8: Gtk.SymbolicColor is deprecated.

classmethod new_name(name)[source]
Parameters:

name (str) – color name

Returns:

a newly created Gtk.SymbolicColor

Return type:

Gtk.SymbolicColor

Creates a symbolic color pointing to an unresolved named color. See Gtk.StyleContext.lookup_color() and Gtk.StyleProperties.lookup_color().

New in version 3.0.

Deprecated since version 3.8: Gtk.SymbolicColor is deprecated.

classmethod new_shade(color, factor)[source]
Parameters:
Returns:

A newly created Gtk.SymbolicColor

Return type:

Gtk.SymbolicColor

Creates a symbolic color defined as a shade of another color. A factor > 1.0 would resolve to a brighter color, while < 1.0 would resolve to a darker color.

New in version 3.0.

Deprecated since version 3.8: Gtk.SymbolicColor is deprecated.

classmethod new_win32(theme_class, id)[source]
Parameters:
  • theme_class (str) – The theme class to pull color from

  • id (int) – The color id

Returns:

A newly created Gtk.SymbolicColor

Return type:

Gtk.SymbolicColor

Creates a symbolic color based on the current win32 theme.

Note that while this call is available on all platforms the actual value returned is not reliable on non-win32 platforms.

New in version 3.4.

Deprecated since version 3.8: Gtk.SymbolicColor is deprecated.

ref()[source]
Returns:

the same self

Return type:

Gtk.SymbolicColor

Increases the reference count of self

New in version 3.0.

Deprecated since version 3.8: Gtk.SymbolicColor is deprecated.

resolve(props)[source]
Parameters:

props (Gtk.StyleProperties or None) – Gtk.StyleProperties to use when resolving named colors, or None

Returns:

True if the color has been resolved

resolved_color:

return location for the resolved color

Return type:

(bool, resolved_color: Gdk.RGBA)

If self is resolvable, resolved_color will be filled in with the resolved color, and True will be returned. Generally, if self can’t be resolved, it is due to it being defined on top of a named color that doesn’t exist in props.

When props is None, resolving of named colors will fail, so if your self is or references such a color, this function will return False.

New in version 3.0.

Deprecated since version 3.8: Gtk.SymbolicColor is deprecated.

to_string()[source]
Returns:

a new string representing self

Return type:

str

Converts the given self to a string representation. This is useful both for debugging and for serialization of strings. The format of the string may change between different versions of GTK, but it is guaranteed that the GTK css parser is able to read the string and create the same symbolic color from it.

Deprecated since version 3.8: Gtk.SymbolicColor is deprecated.

unref()[source]

Decreases the reference count of self, freeing its memory if the reference count reaches 0.

New in version 3.0.

Deprecated since version 3.8: Gtk.SymbolicColor is deprecated.