Files
godot-docs/classes/class_themedb.rst
2025-06-07 03:33:02 +00:00

213 lines
8.4 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ThemeDB.xml.
.. _class_ThemeDB:
ThemeDB
=======
**Inherits:** :ref:`Object<class_Object>`
A singleton that provides access to static information about :ref:`Theme<class_Theme>` resources used by the engine and by your project.
.. rst-class:: classref-introduction-group
Description
-----------
This singleton provides access to static information about :ref:`Theme<class_Theme>` resources used by the engine and by your projects. You can fetch the default engine theme, as well as your project configured theme.
\ **ThemeDB** also contains fallback values for theme properties.
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+-----------------------------------+------------------------------------------------------------------------+---------+
| :ref:`float<class_float>` | :ref:`fallback_base_scale<class_ThemeDB_property_fallback_base_scale>` | ``1.0`` |
+-----------------------------------+------------------------------------------------------------------------+---------+
| :ref:`Font<class_Font>` | :ref:`fallback_font<class_ThemeDB_property_fallback_font>` | |
+-----------------------------------+------------------------------------------------------------------------+---------+
| :ref:`int<class_int>` | :ref:`fallback_font_size<class_ThemeDB_property_fallback_font_size>` | ``16`` |
+-----------------------------------+------------------------------------------------------------------------+---------+
| :ref:`Texture2D<class_Texture2D>` | :ref:`fallback_icon<class_ThemeDB_property_fallback_icon>` | |
+-----------------------------------+------------------------------------------------------------------------+---------+
| :ref:`StyleBox<class_StyleBox>` | :ref:`fallback_stylebox<class_ThemeDB_property_fallback_stylebox>` | |
+-----------------------------------+------------------------------------------------------------------------+---------+
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+---------------------------+------------------------------------------------------------------------+
| :ref:`Theme<class_Theme>` | :ref:`get_default_theme<class_ThemeDB_method_get_default_theme>`\ (\ ) |
+---------------------------+------------------------------------------------------------------------+
| :ref:`Theme<class_Theme>` | :ref:`get_project_theme<class_ThemeDB_method_get_project_theme>`\ (\ ) |
+---------------------------+------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Signals
-------
.. _class_ThemeDB_signal_fallback_changed:
.. rst-class:: classref-signal
**fallback_changed**\ (\ ) :ref:`🔗<class_ThemeDB_signal_fallback_changed>`
Emitted when one of the fallback values had been changed. Use it to refresh the look of controls that may rely on the fallback theme items.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_ThemeDB_property_fallback_base_scale:
.. rst-class:: classref-property
:ref:`float<class_float>` **fallback_base_scale** = ``1.0`` :ref:`🔗<class_ThemeDB_property_fallback_base_scale>`
.. rst-class:: classref-property-setget
- |void| **set_fallback_base_scale**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_fallback_base_scale**\ (\ )
The fallback base scale factor of every :ref:`Control<class_Control>` node and :ref:`Theme<class_Theme>` resource. Used when no other value is available to the control.
See also :ref:`Theme.default_base_scale<class_Theme_property_default_base_scale>`.
.. rst-class:: classref-item-separator
----
.. _class_ThemeDB_property_fallback_font:
.. rst-class:: classref-property
:ref:`Font<class_Font>` **fallback_font** :ref:`🔗<class_ThemeDB_property_fallback_font>`
.. rst-class:: classref-property-setget
- |void| **set_fallback_font**\ (\ value\: :ref:`Font<class_Font>`\ )
- :ref:`Font<class_Font>` **get_fallback_font**\ (\ )
The fallback font of every :ref:`Control<class_Control>` node and :ref:`Theme<class_Theme>` resource. Used when no other value is available to the control.
See also :ref:`Theme.default_font<class_Theme_property_default_font>`.
.. rst-class:: classref-item-separator
----
.. _class_ThemeDB_property_fallback_font_size:
.. rst-class:: classref-property
:ref:`int<class_int>` **fallback_font_size** = ``16`` :ref:`🔗<class_ThemeDB_property_fallback_font_size>`
.. rst-class:: classref-property-setget
- |void| **set_fallback_font_size**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_fallback_font_size**\ (\ )
The fallback font size of every :ref:`Control<class_Control>` node and :ref:`Theme<class_Theme>` resource. Used when no other value is available to the control.
See also :ref:`Theme.default_font_size<class_Theme_property_default_font_size>`.
.. rst-class:: classref-item-separator
----
.. _class_ThemeDB_property_fallback_icon:
.. rst-class:: classref-property
:ref:`Texture2D<class_Texture2D>` **fallback_icon** :ref:`🔗<class_ThemeDB_property_fallback_icon>`
.. rst-class:: classref-property-setget
- |void| **set_fallback_icon**\ (\ value\: :ref:`Texture2D<class_Texture2D>`\ )
- :ref:`Texture2D<class_Texture2D>` **get_fallback_icon**\ (\ )
The fallback icon of every :ref:`Control<class_Control>` node and :ref:`Theme<class_Theme>` resource. Used when no other value is available to the control.
.. rst-class:: classref-item-separator
----
.. _class_ThemeDB_property_fallback_stylebox:
.. rst-class:: classref-property
:ref:`StyleBox<class_StyleBox>` **fallback_stylebox** :ref:`🔗<class_ThemeDB_property_fallback_stylebox>`
.. rst-class:: classref-property-setget
- |void| **set_fallback_stylebox**\ (\ value\: :ref:`StyleBox<class_StyleBox>`\ )
- :ref:`StyleBox<class_StyleBox>` **get_fallback_stylebox**\ (\ )
The fallback stylebox of every :ref:`Control<class_Control>` node and :ref:`Theme<class_Theme>` resource. Used when no other value is available to the control.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_ThemeDB_method_get_default_theme:
.. rst-class:: classref-method
:ref:`Theme<class_Theme>` **get_default_theme**\ (\ ) :ref:`🔗<class_ThemeDB_method_get_default_theme>`
Returns a reference to the default engine :ref:`Theme<class_Theme>`. This theme resource is responsible for the out-of-the-box look of :ref:`Control<class_Control>` nodes and cannot be overridden.
.. rst-class:: classref-item-separator
----
.. _class_ThemeDB_method_get_project_theme:
.. rst-class:: classref-method
:ref:`Theme<class_Theme>` **get_project_theme**\ (\ ) :ref:`🔗<class_ThemeDB_method_get_project_theme>`
Returns a reference to the custom project :ref:`Theme<class_Theme>`. This theme resources allows to override the default engine theme for every control node in the project.
To set the project theme, see :ref:`ProjectSettings.gui/theme/custom<class_ProjectSettings_property_gui/theme/custom>`.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |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.)`
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
.. |void| replace:: :abbr:`void (No return value.)`