Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Theme

Inherits: Resource < RefCounted < Object

A resource used for styling/skinning Controls and Windows.

Description

A resource used for styling/skinning Control and Window nodes. While individual controls can be styled using their local theme overrides (see Control.add_theme_color_override), theme resources allow you to store and apply the same settings across all controls sharing the same type (e.g. style all Buttons the same). One theme resource can be used for the entire project, but you can also set a separate theme resource to a branch of control nodes. A theme resource assigned to a control applies to the control itself, as well as all of its direct and indirect children (as long as a chain of controls is uninterrupted).

Use ProjectSettings.gui/theme/custom to set up a project-scope theme that will be available to every control in your project.

Use Control.theme of any control node to set up a theme that will be available to that control and all of its direct and indirect children.

Tutorials

Properties

float

default_base_scale

0.0

Font

default_font

int

default_font_size

-1

Methods

void

add_type ( StringName theme_type )

void

clear ( )

void

clear_color ( StringName name, StringName theme_type )

void

clear_constant ( StringName name, StringName theme_type )

void

clear_font ( StringName name, StringName theme_type )

void

clear_font_size ( StringName name, StringName theme_type )

void

clear_icon ( StringName name, StringName theme_type )

void

clear_stylebox ( StringName name, StringName theme_type )

void

clear_theme_item ( DataType data_type, StringName name, StringName theme_type )

void

clear_type_variation ( StringName theme_type )

Color

get_color ( StringName name, StringName theme_type ) const

PackedStringArray

get_color_list ( String theme_type ) const

PackedStringArray

get_color_type_list ( ) const

int

get_constant ( StringName name, StringName theme_type ) const

PackedStringArray

get_constant_list ( String theme_type ) const

PackedStringArray

get_constant_type_list ( ) const

Font

get_font ( StringName name, StringName theme_type ) const

PackedStringArray

get_font_list ( String theme_type ) const

int

get_font_size ( StringName name, StringName theme_type ) const

PackedStringArray

get_font_size_list ( String theme_type ) const

PackedStringArray

get_font_size_type_list ( ) const

PackedStringArray

get_font_type_list ( ) const

Texture2D

get_icon ( StringName name, StringName theme_type ) const

PackedStringArray

get_icon_list ( String theme_type ) const

PackedStringArray

get_icon_type_list ( ) const

StyleBox

get_stylebox ( StringName name, StringName theme_type ) const

PackedStringArray

get_stylebox_list ( String theme_type ) const

PackedStringArray

get_stylebox_type_list ( ) const

Variant

get_theme_item ( DataType data_type, StringName name, StringName theme_type ) const

PackedStringArray

get_theme_item_list ( DataType data_type, String theme_type ) const

PackedStringArray

get_theme_item_type_list ( DataType data_type ) const

PackedStringArray

get_type_list ( ) const

StringName

get_type_variation_base ( StringName theme_type ) const

PackedStringArray

get_type_variation_list ( StringName base_type ) const

bool

has_color ( StringName name, StringName theme_type ) const

bool

has_constant ( StringName name, StringName theme_type ) const

bool

has_default_base_scale ( ) const

bool

has_default_font ( ) const

bool

has_default_font_size ( ) const

bool

has_font ( StringName name, StringName theme_type ) const

bool

has_font_size ( StringName name, StringName theme_type ) const

bool

has_icon ( StringName name, StringName theme_type ) const

bool

has_stylebox ( StringName name, StringName theme_type ) const

bool

has_theme_item ( DataType data_type, StringName name, StringName theme_type ) const

bool

is_type_variation ( StringName theme_type, StringName base_type ) const

void

merge_with ( Theme other )

void

remove_type ( StringName theme_type )

void

rename_color ( StringName old_name, StringName name, StringName theme_type )

void

rename_constant ( StringName old_name, StringName name, StringName theme_type )

void

rename_font ( StringName old_name, StringName name, StringName theme_type )

void

rename_font_size ( StringName old_name, StringName name, StringName theme_type )

void

rename_icon ( StringName old_name, StringName name, StringName theme_type )

void

rename_stylebox ( StringName old_name, StringName name, StringName theme_type )

void

rename_theme_item ( DataType data_type, StringName old_name, StringName name, StringName theme_type )

void

set_color ( StringName name, StringName theme_type, Color color )

void

set_constant ( StringName name, StringName theme_type, int constant )

void

set_font ( StringName name, StringName theme_type, Font font )

void

set_font_size ( StringName name, StringName theme_type, int font_size )

void

set_icon ( StringName name, StringName theme_type, Texture2D texture )

void

set_stylebox ( StringName name, StringName theme_type, StyleBox texture )

void

set_theme_item ( DataType data_type, StringName name, StringName theme_type, Variant value )

void

set_type_variation ( StringName theme_type, StringName base_type )


Enumerations

enum DataType:

DataType DATA_TYPE_COLOR = 0

Theme's Color item type.

DataType DATA_TYPE_CONSTANT = 1

Theme's constant item type.

DataType DATA_TYPE_FONT = 2

Theme's Font item type.

DataType DATA_TYPE_FONT_SIZE = 3

Theme's font size item type.

DataType DATA_TYPE_ICON = 4

Theme's icon Texture2D item type.

DataType DATA_TYPE_STYLEBOX = 5

Theme's StyleBox item type.

DataType DATA_TYPE_MAX = 6

Maximum value for the DataType enum.


Property Descriptions

float default_base_scale = 0.0

  • void set_default_base_scale ( float value )

  • float get_default_base_scale ( )

The default base scale factor of this theme resource. Used by some controls to scale their visual properties based on the global scale factor. If this value is set to