:github_url: hide .. Generated automatically by doc/tools/make_rst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the Theme.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_Theme: Theme ===== **Inherits:** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` Theme for controls. Description ----------- A theme for skinning controls. Controls can be skinned individually, but for complex applications, it's more practical to just create a global theme that defines everything. This theme can be applied to any :ref:`Control`; the Control and its children will automatically use it. Theme resources can alternatively be loaded by writing them in a ``.theme`` file, see the documentation for more information. Tutorials --------- - :doc:`GUI skinning <../tutorials/ui/gui_skinning>` Properties ---------- +---------------------------+--------------------------------------------------------------------+---------+ | :ref:`float` | :ref:`default_base_scale` | ``0.0`` | +---------------------------+--------------------------------------------------------------------+---------+ | :ref:`Font` | :ref:`default_font` | | +---------------------------+--------------------------------------------------------------------+---------+ | :ref:`int` | :ref:`default_font_size` | ``-1`` | +---------------------------+--------------------------------------------------------------------+---------+ Methods ------- +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear` **(** **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_color` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_constant` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_font` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_font_size` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_icon` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_stylebox` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_theme_item` **(** :ref:`DataType` data_type, :ref:`StringName` name, :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_type_variation` **(** :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Color` | :ref:`get_color` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_color_list` **(** :ref:`String` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_color_type_list` **(** **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_constant` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_constant_list` **(** :ref:`String` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_constant_type_list` **(** **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Font` | :ref:`get_font` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_font_list` **(** :ref:`String` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_font_size` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_font_size_list` **(** :ref:`String` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_font_size_type_list` **(** **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_font_type_list` **(** **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Texture2D` | :ref:`get_icon` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_icon_list` **(** :ref:`String` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_icon_type_list` **(** **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`StyleBox` | :ref:`get_stylebox` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_stylebox_list` **(** :ref:`String` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_stylebox_type_list` **(** **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`get_theme_item` **(** :ref:`DataType` data_type, :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_theme_item_list` **(** :ref:`DataType` data_type, :ref:`String` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_theme_item_type_list` **(** :ref:`DataType` data_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_type_list` **(** **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`StringName` | :ref:`get_type_variation_base` **(** :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_type_variation_list` **(** :ref:`StringName` base_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_color` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_constant` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_default_base_scale` **(** **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_default_font` **(** **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_default_font_size` **(** **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_font` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_font_size` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_icon` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_stylebox` **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_theme_item` **(** :ref:`DataType` data_type, :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_type_variation` **(** :ref:`StringName` theme_type, :ref:`StringName` base_type **)** |const| | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`merge_with` **(** :ref:`Theme` other **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`rename_color` **(** :ref:`StringName` old_name, :ref:`StringName` name, :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`rename_constant` **(** :ref:`StringName` old_name, :ref:`StringName` name, :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`rename_font` **(** :ref:`StringName` old_name, :ref:`StringName` name, :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`rename_font_size` **(** :ref:`StringName` old_name, :ref:`StringName` name, :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`rename_icon` **(** :ref:`StringName` old_name, :ref:`StringName` name, :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`rename_stylebox` **(** :ref:`StringName` old_name, :ref:`StringName` name, :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`rename_theme_item` **(** :ref:`DataType` data_type, :ref:`StringName` old_name, :ref:`StringName` name, :ref:`StringName` theme_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_color` **(** :ref:`StringName` name, :ref:`StringName` theme_type, :ref:`Color` color **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_constant` **(** :ref:`StringName` name, :ref:`StringName` theme_type, :ref:`int` constant **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_font` **(** :ref:`StringName` name, :ref:`StringName` theme_type, :ref:`Font` font **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_font_size` **(** :ref:`StringName` name, :ref:`StringName` theme_type, :ref:`int` font_size **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_icon` **(** :ref:`StringName` name, :ref:`StringName` theme_type, :ref:`Texture2D` texture **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_stylebox` **(** :ref:`StringName` name, :ref:`StringName` theme_type, :ref:`StyleBox` texture **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_theme_item` **(** :ref:`DataType` data_type, :ref:`StringName` name, :ref:`StringName` theme_type, :ref:`Variant` value **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_type_variation` **(** :ref:`StringName` theme_type, :ref:`StringName` base_type **)** | +---------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Enumerations ------------ .. _enum_Theme_DataType: .. _class_Theme_constant_DATA_TYPE_COLOR: .. _class_Theme_constant_DATA_TYPE_CONSTANT: .. _class_Theme_constant_DATA_TYPE_FONT: .. _class_Theme_constant_DATA_TYPE_FONT_SIZE: .. _class_Theme_constant_DATA_TYPE_ICON: .. _class_Theme_constant_DATA_TYPE_STYLEBOX: .. _class_Theme_constant_DATA_TYPE_MAX: enum **DataType**: - **DATA_TYPE_COLOR** = **0** --- Theme's :ref:`Color` item type. - **DATA_TYPE_CONSTANT** = **1** --- Theme's constant item type. - **DATA_TYPE_FONT** = **2** --- Theme's :ref:`Font` item type. - **DATA_TYPE_FONT_SIZE** = **3** --- Theme's font size item type. - **DATA_TYPE_ICON** = **4** --- Theme's icon :ref:`Texture2D` item type. - **DATA_TYPE_STYLEBOX** = **5** --- Theme's :ref:`StyleBox` item type. - **DATA_TYPE_MAX** = **6** --- Maximum value for the DataType enum. Property Descriptions --------------------- .. _class_Theme_property_default_base_scale: - :ref:`float` **default_base_scale** +-----------+-------------------------------+ | *Default* | ``0.0`` | +-----------+-------------------------------+ | *Setter* | set_default_base_scale(value) | +-----------+-------------------------------+ | *Getter* | get_default_base_scale() | +-----------+-------------------------------+ The default base scale factor of this ``Theme`` resource. Used by some controls to scale their visual properties based on a global scale factor. If this value is set to ``0.0``, the global scale factor is used. Use :ref:`has_default_base_scale` to check if this value is valid. ---- .. _class_Theme_property_default_font: - :ref:`Font` **default_font** +----------+-------------------------+ | *Setter* | set_default_font(value) | +----------+-------------------------+ | *Getter* | get_default_font() | +----------+-------------------------+ The default font of this ``Theme`` resource. Used as a fallback value for font items defined in this theme, but having invalid values. If this value is also invalid, the global default value is used. Use :ref:`has_default_font` to check if this value is valid. ---- .. _class_Theme_property_default_font_size: - :ref:`int` **default_font_size** +-----------+------------------------------+ | *Default* | ``-1`` | +-----------+------------------------------+ | *Setter* | set_default_font_size(value) | +-----------+------------------------------+ | *Getter* | get_default_font_size() | +-----------+------------------------------+ The default font size of this ``Theme`` resource. Used as a fallback value for font size items defined in this theme, but having invalid values. If this value is set to ``-1``, the global default value is used. Use :ref:`has_default_font_size` to check if this value is valid. Method Descriptions ------------------- .. _class_Theme_method_clear: - void **clear** **(** **)** Clears all values on the theme. ---- .. _class_Theme_method_clear_color: - void **clear_color** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** Clears the :ref:`Color` at ``name`` if the theme has ``theme_type``. ---- .. _class_Theme_method_clear_constant: - void **clear_constant** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** Clears the constant at ``name`` if the theme has ``theme_type``. ---- .. _class_Theme_method_clear_font: - void **clear_font** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** Clears the :ref:`Font` at ``name`` if the theme has ``theme_type``. ---- .. _class_Theme_method_clear_font_size: - void **clear_font_size** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** Clears the font size ``name`` if the theme has ``theme_type``. ---- .. _class_Theme_method_clear_icon: - void **clear_icon** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** Clears the icon at ``name`` if the theme has ``theme_type``. ---- .. _class_Theme_method_clear_stylebox: - void **clear_stylebox** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** Clears :ref:`StyleBox` at ``name`` if the theme has ``theme_type``. ---- .. _class_Theme_method_clear_theme_item: - void **clear_theme_item** **(** :ref:`DataType` data_type, :ref:`StringName` name, :ref:`StringName` theme_type **)** Clears the theme item of ``data_type`` at ``name`` if the theme has ``theme_type``. ---- .. _class_Theme_method_clear_type_variation: - void **clear_type_variation** **(** :ref:`StringName` theme_type **)** Unmarks ``theme_type`` as being a variation of any other type. ---- .. _class_Theme_method_get_color: - :ref:`Color` **get_color** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| Returns the :ref:`Color` at ``name`` if the theme has ``theme_type``. ---- .. _class_Theme_method_get_color_list: - :ref:`PackedStringArray` **get_color_list** **(** :ref:`String` theme_type **)** |const| Returns all the :ref:`Color`\ s as a :ref:`PackedStringArray` filled with each :ref:`Color`'s name, for use in :ref:`get_color`, if the theme has ``theme_type``. ---- .. _class_Theme_method_get_color_type_list: - :ref:`PackedStringArray` **get_color_type_list** **(** **)** |const| Returns all the :ref:`Color` types as a :ref:`PackedStringArray` filled with unique type names, for use in :ref:`get_color` and/or :ref:`get_color_list`. ---- .. _class_Theme_method_get_constant: - :ref:`int` **get_constant** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| Returns the constant at ``name`` if the theme has ``theme_type``. ---- .. _class_Theme_method_get_constant_list: - :ref:`PackedStringArray` **get_constant_list** **(** :ref:`String` theme_type **)** |const| Returns all the constants as a :ref:`PackedStringArray` filled with each constant's name, for use in :ref:`get_constant`, if the theme has ``theme_type``. ---- .. _class_Theme_method_get_constant_type_list: - :ref:`PackedStringArray` **get_constant_type_list** **(** **)** |const| Returns all the constant types as a :ref:`PackedStringArray` filled with unique type names, for use in :ref:`get_constant` and/or :ref:`get_constant_list`. ---- .. _class_Theme_method_get_font: - :ref:`Font` **get_font** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| Returns the :ref:`Font` at ``name`` if the theme has ``theme_type``. ---- .. _class_Theme_method_get_font_list: - :ref:`PackedStringArray` **get_font_list** **(** :ref:`String` theme_type **)** |const| Returns all the :ref:`Font`\ s as a :ref:`PackedStringArray` filled with each :ref:`Font`'s name, for use in :ref:`get_font`, if the theme has ``theme_type``. ---- .. _class_Theme_method_get_font_size: - :ref:`int` **get_font_size** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| Returns the font size at ``name`` if the theme has ``theme_type``. ---- .. _class_Theme_method_get_font_size_list: - :ref:`PackedStringArray` **get_font_size_list** **(** :ref:`String` theme_type **)** |const| Returns all the font sizes as a :ref:`PackedStringArray` filled with each font size name, for use in :ref:`get_font_size`, if the theme has ``theme_type``. ---- .. _class_Theme_method_get_font_size_type_list: - :ref:`PackedStringArray` **get_font_size_type_list** **(** **)** |const| Returns all the font size types as a :ref:`PackedStringArray` filled with unique type names, for use in :ref:`get_font_size` and/or :ref:`get_font_size_list`. ---- .. _class_Theme_method_get_font_type_list: - :ref:`PackedStringArray` **get_font_type_list** **(** **)** |const| Returns all the :ref:`Font` types as a :ref:`PackedStringArray` filled with unique type names, for use in :ref:`get_font` and/or :ref:`get_font_list`. ---- .. _class_Theme_method_get_icon: - :ref:`Texture2D` **get_icon** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| Returns the icon :ref:`Texture2D` at ``name`` if the theme has ``theme_type``. ---- .. _class_Theme_method_get_icon_list: - :ref:`PackedStringArray` **get_icon_list** **(** :ref:`String` theme_type **)** |const| Returns all the icons as a :ref:`PackedStringArray` filled with each :ref:`Texture2D`'s name, for use in :ref:`get_icon`, if the theme has ``theme_type``. ---- .. _class_Theme_method_get_icon_type_list: - :ref:`PackedStringArray` **get_icon_type_list** **(** **)** |const| Returns all the icon types as a :ref:`PackedStringArray` filled with unique type names, for use in :ref:`get_icon` and/or :ref:`get_icon_list`. ---- .. _class_Theme_method_get_stylebox: - :ref:`StyleBox` **get_stylebox** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| Returns the :ref:`StyleBox` at ``name`` if the theme has ``theme_type``. Valid ``name``\ s may be found using :ref:`get_stylebox_list`. Valid ``theme_type``\ s may be found using :ref:`get_stylebox_type_list`. ---- .. _class_Theme_method_get_stylebox_list: - :ref:`PackedStringArray` **get_stylebox_list** **(** :ref:`String` theme_type **)** |const| Returns all the :ref:`StyleBox`\ s as a :ref:`PackedStringArray` filled with each :ref:`StyleBox`'s name, for use in :ref:`get_stylebox`, if the theme has ``theme_type``. Valid ``theme_type``\ s may be found using :ref:`get_stylebox_type_list`. ---- .. _class_Theme_method_get_stylebox_type_list: - :ref:`PackedStringArray` **get_stylebox_type_list** **(** **)** |const| Returns all the :ref:`StyleBox` types as a :ref:`PackedStringArray` filled with unique type names, for use in :ref:`get_stylebox` and/or :ref:`get_stylebox_list`. ---- .. _class_Theme_method_get_theme_item: - :ref:`Variant` **get_theme_item** **(** :ref:`DataType` data_type, :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| Returns the theme item of ``data_type`` at ``name`` if the theme has ``theme_type``. Valid ``name``\ s may be found using :ref:`get_theme_item_list` or a data type specific method. Valid ``theme_type``\ s may be found using :ref:`get_theme_item_type_list` or a data type specific method. ---- .. _class_Theme_method_get_theme_item_list: - :ref:`PackedStringArray` **get_theme_item_list** **(** :ref:`DataType` data_type, :ref:`String` theme_type **)** |const| Returns all the theme items of ``data_type`` as a :ref:`PackedStringArray` filled with each theme items's name, for use in :ref:`get_theme_item` or a data type specific method, if the theme has ``theme_type``. Valid ``theme_type``\ s may be found using :ref:`get_theme_item_type_list` or a data type specific method. ---- .. _class_Theme_method_get_theme_item_type_list: - :ref:`PackedStringArray` **get_theme_item_type_list** **(** :ref:`DataType` data_type **)** |const| Returns all the theme items of ``data_type`` types as a :ref:`PackedStringArray` filled with unique type names, for use in :ref:`get_theme_item`, :ref:`get_theme_item_list` or data type specific methods. ---- .. _class_Theme_method_get_type_list: - :ref:`PackedStringArray` **get_type_list** **(** **)** |const| Returns all the theme types as a :ref:`PackedStringArray` filled with unique type names, for use in other ``get_*`` functions of this theme. ---- .. _class_Theme_method_get_type_variation_base: - :ref:`StringName` **get_type_variation_base** **(** :ref:`StringName` theme_type **)** |const| Returns the base theme type if ``theme_type`` is a valid variation type. Returns an empty string otherwise. ---- .. _class_Theme_method_get_type_variation_list: - :ref:`PackedStringArray` **get_type_variation_list** **(** :ref:`StringName` base_type **)** |const| Returns a list of all variation for the given ``base_type``. ---- .. _class_Theme_method_has_color: - :ref:`bool` **has_color** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| Returns ``true`` if :ref:`Color` with ``name`` is in ``theme_type``. Returns ``false`` if the theme does not have ``theme_type``. ---- .. _class_Theme_method_has_constant: - :ref:`bool` **has_constant** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| Returns ``true`` if constant with ``name`` is in ``theme_type``. Returns ``false`` if the theme does not have ``theme_type``. ---- .. _class_Theme_method_has_default_base_scale: - :ref:`bool` **has_default_base_scale** **(** **)** |const| Returns ``true`` if this theme has a valid :ref:`default_base_scale` value. ---- .. _class_Theme_method_has_default_font: - :ref:`bool` **has_default_font** **(** **)** |const| Returns ``true`` if this theme has a valid :ref:`default_font` value. ---- .. _class_Theme_method_has_default_font_size: - :ref:`bool` **has_default_font_size** **(** **)** |const| Returns ``true`` if this theme has a valid :ref:`default_font_size` value. ---- .. _class_Theme_method_has_font: - :ref:`bool` **has_font** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| Returns ``true`` if :ref:`Font` with ``name`` is in ``theme_type``. Returns ``false`` if the theme does not have ``theme_type``. ---- .. _class_Theme_method_has_font_size: - :ref:`bool` **has_font_size** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| Returns ``true`` if font size with ``name`` is in ``theme_type``. Returns ``false`` if the theme does not have ``theme_type``. ---- .. _class_Theme_method_has_icon: - :ref:`bool` **has_icon** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| Returns ``true`` if icon :ref:`Texture2D` with ``name`` is in ``theme_type``. Returns ``false`` if the theme does not have ``theme_type``. ---- .. _class_Theme_method_has_stylebox: - :ref:`bool` **has_stylebox** **(** :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| Returns ``true`` if :ref:`StyleBox` with ``name`` is in ``theme_type``. Returns ``false`` if the theme does not have ``theme_type``. ---- .. _class_Theme_method_has_theme_item: - :ref:`bool` **has_theme_item** **(** :ref:`DataType` data_type, :ref:`StringName` name, :ref:`StringName` theme_type **)** |const| Returns ``true`` if a theme item of ``data_type`` with ``name`` is in ``theme_type``. Returns ``false`` if the theme does not have ``theme_type``. ---- .. _class_Theme_method_is_type_variation: - :ref:`bool` **is_type_variation** **(** :ref:`StringName` theme_type, :ref:`StringName` base_type **)** |const| Returns ``true`` if ``theme_type`` is marked as a variation of ``base_type`` in this theme. ---- .. _class_Theme_method_merge_with: - void **merge_with** **(** :ref:`Theme` other **)** Adds missing and overrides existing definitions with values from the ``other`` ``Theme``. **Note:** This modifies the current theme. If you want to merge two themes together without modifying either one, create a new empty theme and merge the other two into it one after another. ---- .. _class_Theme_method_rename_color: - void **rename_color** **(** :ref:`StringName` old_name, :ref:`StringName` name, :ref:`StringName` theme_type **)** Renames the :ref:`Color` at ``old_name`` to ``name`` if the theme has ``theme_type``. If ``name`` is already taken, this method fails. ---- .. _class_Theme_method_rename_constant: - void **rename_constant** **(** :ref:`StringName` old_name, :ref:`StringName` name, :ref:`StringName` theme_type **)** Renames the constant at ``old_name`` to ``name`` if the theme has ``theme_type``. If ``name`` is already taken, this method fails. ---- .. _class_Theme_method_rename_font: - void **rename_font** **(** :ref:`StringName` old_name, :ref:`StringName` name, :ref:`StringName` theme_type **)** Renames the :ref:`Font` at ``old_name`` to ``name`` if the theme has ``theme_type``. If ``name`` is already taken, this method fails. ---- .. _class_Theme_method_rename_font_size: - void **rename_font_size** **(** :ref:`StringName` old_name, :ref:`StringName` name, :ref:`StringName` theme_type **)** Renames the font size ``old_name`` to ``name`` if the theme has ``theme_type``. If ``name`` is already taken, this method fails. ---- .. _class_Theme_method_rename_icon: - void **rename_icon** **(** :ref:`StringName` old_name, :ref:`StringName` name, :ref:`StringName` theme_type **)** Renames the icon at ``old_name`` to ``name`` if the theme has ``theme_type``. If ``name`` is already taken, this method fails. ---- .. _class_Theme_method_rename_stylebox: - void **rename_stylebox** **(** :ref:`StringName` old_name, :ref:`StringName` name, :ref:`StringName` theme_type **)** Renames :ref:`StyleBox` at ``old_name`` to ``name`` if the theme has ``theme_type``. If ``name`` is already taken, this method fails. ---- .. _class_Theme_method_rename_theme_item: - void **rename_theme_item** **(** :ref:`DataType` data_type, :ref:`StringName` old_name, :ref:`StringName` name, :ref:`StringName` theme_type **)** Renames the theme item of ``data_type`` at ``old_name`` to ``name`` if the theme has ``theme_type``. If ``name`` is already taken, this method fails. ---- .. _class_Theme_method_set_color: - void **set_color** **(** :ref:`StringName` name, :ref:`StringName` theme_type, :ref:`Color` color **)** Sets the theme's :ref:`Color` to ``color`` at ``name`` in ``theme_type``. Creates ``theme_type`` if the theme does not have it. ---- .. _class_Theme_method_set_constant: - void **set_constant** **(** :ref:`StringName` name, :ref:`StringName` theme_type, :ref:`int` constant **)** Sets the theme's constant to ``constant`` at ``name`` in ``theme_type``. Creates ``theme_type`` if the theme does not have it. ---- .. _class_Theme_method_set_font: - void **set_font** **(** :ref:`StringName` name, :ref:`StringName` theme_type, :ref:`Font` font **)** Sets the theme's :ref:`Font` to ``font`` at ``name`` in ``theme_type``. Creates ``theme_type`` if the theme does not have it. ---- .. _class_Theme_method_set_font_size: - void **set_font_size** **(** :ref:`StringName` name, :ref:`StringName` theme_type, :ref:`int` font_size **)** Sets the theme's font size to ``font_size`` at ``name`` in ``theme_type``. Creates ``theme_type`` if the theme does not have it. ---- .. _class_Theme_method_set_icon: - void **set_icon** **(** :ref:`StringName` name, :ref:`StringName` theme_type, :ref:`Texture2D` texture **)** Sets the theme's icon :ref:`Texture2D` to ``texture`` at ``name`` in ``theme_type``. Creates ``theme_type`` if the theme does not have it. ---- .. _class_Theme_method_set_stylebox: - void **set_stylebox** **(** :ref:`StringName` name, :ref:`StringName` theme_type, :ref:`StyleBox` texture **)** Sets theme's :ref:`StyleBox` to ``stylebox`` at ``name`` in ``theme_type``. Creates ``theme_type`` if the theme does not have it. ---- .. _class_Theme_method_set_theme_item: - void **set_theme_item** **(** :ref:`DataType` data_type, :ref:`StringName` name, :ref:`StringName` theme_type, :ref:`Variant` value **)** Sets the theme item of ``data_type`` to ``value`` at ``name`` in ``theme_type``. Does nothing if the ``value`` type does not match ``data_type``. Creates ``theme_type`` if the theme does not have it. ---- .. _class_Theme_method_set_type_variation: - void **set_type_variation** **(** :ref:`StringName` theme_type, :ref:`StringName` base_type **)** Marks ``theme_type`` as being a variation of ``base_type``. This adds ``theme_type`` as a suggested option for :ref:`Control.theme_type_variation` on a :ref:`Control` that is of the ``base_type`` class. Variations can also be nested, i.e. ``base_type`` can be another variation. If a chain of variations ends with a ``base_type`` matching a class of a :ref:`Control`, the whole chain is going to be suggested as options. **Note:** Suggestions only show up if this ``Theme`` is set as the project default theme. See :ref:`ProjectSettings.gui/theme/custom`. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`