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 ( Stri