Skip to content

style

get_app_icon_path()

Path to AYON icon.

Source code in client/ayon_core/style/__init__.py
208
209
210
def get_app_icon_path():
    """Path to AYON icon."""
    return resources.get_ayon_icon_filepath()

get_colors_data()

Only color data from stylesheet data.

Source code in client/ayon_core/style/__init__.py
50
51
52
53
54
55
56
def get_colors_data():
    """Only color data from stylesheet data."""
    if _Cache.colors_data is None:
        data = _get_colors_raw_data()
        color_data = data.get("color") or {}
        _Cache.colors_data = color_data
    return copy.deepcopy(_Cache.colors_data)

get_default_entity_icon_color()

Default color of entities icons.

Color must be possible to parse using QColor.

Returns:

Name Type Description
str

Color as a string.

Source code in client/ayon_core/style/__init__.py
232
233
234
235
236
237
238
239
240
241
242
243
def get_default_entity_icon_color():
    """Default color of entities icons.

    Color must be possible to parse using QColor.

    Returns:
        str: Color as a string.
    """
    if _Cache.default_entity_icon_color is None:
        color_data = get_colors_data()
        _Cache.default_entity_icon_color = color_data["icon-entity-default"]
    return _Cache.default_entity_icon_color

get_default_tools_icon_color()

Default color used in tool icons.

Color must be possible to parse using QColor.

Returns:

Name Type Description
str

Color as a string.

Source code in client/ayon_core/style/__init__.py
218
219
220
221
222
223
224
225
226
227
228
229
def get_default_tools_icon_color():
    """Default color used in tool icons.

    Color must be possible to parse using QColor.

    Returns:
        str: Color as a string.
    """
    if _Cache.tools_icon_color is None:
        color_data = get_colors_data()
        _Cache.tools_icon_color = color_data["icon-tools"]
    return _Cache.tools_icon_color

get_deprecated_entity_font_color()

Font color for deprecated entities.

Color must be possible to parse using QColor.

Returns:

Name Type Description
str

Color as a string.

Source code in client/ayon_core/style/__init__.py
262
263
264
265
266
267
268
269
270
271
272
273
274
275
def get_deprecated_entity_font_color():
    """Font color for deprecated entities.

    Color must be possible to parse using QColor.

    Returns:
        str: Color as a string.
    """
    if _Cache.deprecated_entity_font_color is None:
        color_data = get_colors_data()
        _Cache.deprecated_entity_font_color = (
            color_data["font-entity-deprecated"]
        )
    return _Cache.deprecated_entity_font_color

get_disabled_entity_icon_color()

Default color of entities icons.

TODO: Find more suitable function name.

Color must be possible to parse using QColor.

Returns:

Name Type Description
str

Color as a string.

Source code in client/ayon_core/style/__init__.py
246
247
248
249
250
251
252
253
254
255
256
257
258
259
def get_disabled_entity_icon_color():
    """Default color of entities icons.

    TODO: Find more suitable function name.

    Color must be possible to parse using QColor.

    Returns:
        str: Color as a string.
    """
    if _Cache.disabled_entity_icon_color is None:
        color_data = get_colors_data()
        _Cache.disabled_entity_icon_color = color_data["icon-entity-disabled"]
    return _Cache.disabled_entity_icon_color

get_objected_colors(*keys)

Colors parsed from stylesheet data into color definitions.

You can pass multiple arguments to get a key from the data dict's colors. Because this functions returns a deep copy of the cached data this allows a much smaller dataset to be copied and thus result in a faster function. It is however a micro-optimization in the area of 0.001s and smaller.

For example

get_colors_data() # copy of full colors dict get_colors_data("font") get_colors_data("loader", "asset-view")

Parameters:

Name Type Description Default
*keys

Each key argument will return a key nested deeper in the objected colors data.

()

Returns:

Name Type Description
Any

Parsed color objects by keys in data.

Source code in client/ayon_core/style/__init__.py
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
def get_objected_colors(*keys):
    """Colors parsed from stylesheet data into color definitions.

    You can pass multiple arguments to get a key from the data dict's colors.
    Because this functions returns a deep copy of the cached data this allows
    a much smaller dataset to be copied and thus result in a faster function.
    It is however a micro-optimization in the area of 0.001s and smaller.

    For example:
        >>> get_colors_data()           # copy of full colors dict
        >>> get_colors_data("font")
        >>> get_colors_data("loader", "asset-view")

    Args:
        *keys: Each key argument will return a key nested deeper in the
            objected colors data.

    Returns:
        Any: Parsed color objects by keys in data.
    """
    if _Cache.objected_colors is None:
        colors_data = get_colors_data()
        output = {}
        for key, value in colors_data.items():
            output[key] = _convert_color_values_to_objects(value)

        _Cache.objected_colors = output

    output = _Cache.objected_colors
    for key in keys:
        output = output[key]
    return copy.deepcopy(output)

load_stylesheet()

Load and return AYON Qt stylesheet.

Source code in client/ayon_core/style/__init__.py
199
200
201
202
203
204
205
def load_stylesheet():
    """Load and return AYON Qt stylesheet."""

    if _Cache.stylesheet is None:
        _Cache.stylesheet = _load_stylesheet()
    _load_font()
    return _Cache.stylesheet