Theme

Inherits: Resource < Reference < 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 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

Properties

Font

default_font

Methods

void

add_type ( String theme_type )

void

clear ( )

void

clear_color ( String name, String theme_type )

void

clear_constant ( String name, String theme_type )

void

clear_font ( String name, String theme_type )

void

clear_icon ( String name, String theme_type )

void

clear_stylebox ( String name, String theme_type )

void

clear_theme_item ( DataType data_type, String name, String theme_type )

void

clear_type_variation ( String theme_type )

void

copy_default_theme ( )

void

copy_theme ( Theme other )

Color

get_color ( String name, String theme_type ) const

PoolStringArray

get_color_list ( String theme_type ) const

PoolStringArray

get_color_types ( ) const

int

get_constant ( String name, String theme_type ) const

PoolStringArray

get_constant_list ( String theme_type ) const

PoolStringArray

get_constant_types ( ) const

Font

get_font ( String name, String theme_type ) const

PoolStringArray

get_font_list ( String theme_type ) const

PoolStringArray

get_font_types ( ) const

Texture

get_icon ( String name, String theme_type ) const

PoolStringArray

get_icon_list ( String theme_type ) const

PoolStringArray

get_icon_types ( ) const

StyleBox

get_stylebox ( String name, String theme_type ) const

PoolStringArray

get_stylebox_list ( String theme_type ) const

PoolStringArray

get_stylebox_types ( ) const

Variant

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

PoolStringArray

get_theme_item_list ( DataType data_type, String theme_type ) const

PoolStringArray

get_theme_item_types ( DataType data_type ) const

PoolStringArray

get_type_list ( String theme_type ) const

String

get_type_variation_base ( String theme_type ) const

PoolStringArray

get_type_variation_list ( String base_type ) const

bool

has_color ( String name, String theme_type ) const

bool

has_constant ( String name, String theme_type ) const

bool

has_default_font ( ) const

bool

has_font ( String name, String theme_type ) const

bool

has_icon ( String name, String theme_type ) const

bool

has_stylebox ( String name, String theme_type ) const

bool

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

bool

is_type_variation ( String theme_type, String base_type ) const

void

merge_with ( Theme other )

void

remove_type ( String theme_type )

void

rename_color ( String old_name, String name, String theme_type )

void

rename_constant ( String old_name, String name, String theme_type )

void

rename_font ( String old_name, String name, String theme_type )

void

rename_icon ( String old_name, String name, String theme_type )

void

rename_stylebox ( String old_name, String name, String theme_type )

void

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

void

set_color ( String name, String theme_type, Color color )

void

set_constant ( String name, String theme_type, int constant )

void

set_font ( String name, String theme_type, Font font )

void

set_icon ( String name, String theme_type, Texture texture )

void

set_stylebox ( String name, String theme_type, StyleBox texture )

void

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

void

set_type_variation ( String theme_type, String 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_ICON = 3

Theme's icon Texture item type.

DataType DATA_TYPE_STYLEBOX = 4

Theme's StyleBox item type.

DataType DATA_TYPE_MAX = 5

Maximum value for the DataType enum.


Property Descriptions

Font default_font

  • void set_default_font ( Font value )

  • Font 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 has_default_font to check if this value is valid.


Method Descriptions

void add_type ( String theme_type )

Adds an empty theme type for every valid data type.

Note: Empty types are not saved with the theme. This method only exists to perform in-memory changes to the resource. Use available set_* methods to add theme items.


void clear ( )

Clears all values on the theme.


void clear_color ( String name, String theme_type )

Clears the Color at name if the theme has theme_type.


void clear_constant ( String name, String theme_type )

Clears the constant at name if the theme has theme_type.


void clear_font ( String name, String theme_type )

Clears the Font at name if the theme has theme_type.


void clear_icon ( String name, String theme_type )

Clears the icon at name if the theme has theme_type.


void clear_stylebox ( String name, String theme_type )

Clears StyleBox at name if the theme has theme_type.


void clear_theme_item ( DataType data_type, String name, String theme_type )

Clears the theme item of data_type at name if the theme has theme_type.


void clear_type_variation ( String theme_type )

Unmarks theme_type as being a variation of another theme type. See set_type_variation.


void copy_default_theme ( )

Sets the theme's values to a copy of the default theme values.


void copy_theme ( Theme other )

Sets the theme's values to a copy of a given theme.


Color get_color ( String name, String theme_type ) const

Returns the Color at name if the theme has theme_type.


PoolStringArray get_color_list ( String theme_type ) const

Returns all the Colors as a PoolStringArray filled with each Color's name, for use in get_color, if the theme has theme_type.


PoolStringArray get_color_types ( ) const

Returns all the Color types as a PoolStringArray filled with unique type names, for use in get_color and/or get_color_list.


int get_constant ( String name, String theme_type ) const

Returns the constant at name if the theme has theme_type.


PoolStringArray get_constant_list ( String theme_type ) const

Returns all the constants as a PoolStringArray filled with each constant's name, for use in get_constant, if the theme has theme_type.


PoolStringArray get_constant_types ( ) const

Returns all the constant types as a PoolStringArray filled with unique type names, for use in get_constant and/or get_constant_list.


Font get_font ( String name, String theme_type ) const

Returns the Font at name if the theme has theme_type. If such item does not exist and default_font is set on the theme, the default font will be returned.


PoolStringArray get_font_list ( String theme_type ) const

Returns all the Fonts as a PoolStringArray filled with each Font's name, for use in get_font, if the theme has theme_type.


PoolStringArray get_font_types ( ) const

Returns all the Font types as a PoolStringArray filled with unique type names, for use in get_font and/or get_font_list.


Texture get_icon ( String name, String theme_type ) const

Returns the icon Texture at name if the theme has theme_type.


PoolStringArray get_icon_list ( String theme_type ) const

Returns all the icons as a PoolStringArray filled with each Texture's name, for use in get_icon, if the theme has theme_type.


PoolStringArray get_icon_types ( ) const

Returns all the icon types as a PoolStringArray filled with unique type names, for use in get_icon and/or get_icon_list.


StyleBox get_stylebox ( String name, String theme_type ) const

Returns the StyleBox at name if the theme has theme_type.

Valid names may be found using get_stylebox_list. Valid theme_types may be found using get_stylebox_types.


PoolStringArray get_stylebox_list ( String theme_type ) const

Returns all the StyleBoxs as a PoolStringArray filled with each StyleBox's name, for use in get_stylebox, if the theme has theme_type.

Valid theme_types may be found using get_stylebox_types.


PoolStringArray get_stylebox_types ( ) const

Returns all the StyleBox types as a PoolStringArray filled with unique type names, for use in get_stylebox and/or get_stylebox_list.


Variant get_theme_item ( DataType data_type, String name, String theme_type ) const

Returns the theme item of data_type at name if the theme has theme_type.

Valid names may be found using get_theme_item_list or a data type specific method. Valid theme_types may be found using get_theme_item_types or a data type specific method.


PoolStringArray get_theme_item_list ( DataType data_type, String theme_type ) const

Returns all the theme items of data_type as a PoolStringArray filled with each theme items's name, for use in get_theme_item or a data type specific method, if the theme has theme_type.

Valid theme_types may be found using get_theme_item_types or a data type specific method.


PoolStringArray get_theme_item_types ( DataType data_type ) const

Returns all the theme items of data_type types as a PoolStringArray filled with unique type names, for use in get_theme_item, get_theme_item_list or data type specific methods.


PoolStringArray get_type_list ( String theme_type ) const

Returns all the theme types as a PoolStringArray filled with unique type names, for use in other get_* functions of this theme.

Note: theme_type has no effect and will be removed in future version.


String get_type_variation_base ( String theme_type ) const

Returns the name of the base theme type if theme_type is a valid variation type. Returns an empty string otherwise.


PoolStringArray get_type_variation_list ( String base_type ) const

Returns a list of all type variations for the given base_type.


bool has_color ( String name, String theme_type ) const

Returns true if Color with name is in theme_type.

Returns false if the theme does not have theme_type.


bool has_constant ( String name, String theme_type ) const

Returns true if constant with name is in theme_type.

Returns false if the theme does not have theme_type.


bool has_default_font ( ) const

Returns true if this theme has a valid default_font value.


bool has_font ( String name, String theme_type ) const

Returns true if Font with name is in theme_type.

Returns false if the theme does not have theme_type.


bool has_icon ( String name, String theme_type ) const

Returns true if icon Texture with name is in theme_type.

Returns false if the theme does not have theme_type.


bool has_stylebox ( String name, String theme_type ) const

Returns true if StyleBox with name is in theme_type.

Returns false if the theme does not have theme_type.


bool has_theme_item ( DataType data_type, String name, String 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.


bool is_type_variation ( String theme_type, String base_type ) const

Returns true if theme_type is marked as a variation of base_type.


void merge_with ( 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.


void remove_type ( String theme_type )

Removes the theme type, gracefully discarding defined theme items. If the type is a variation, this information is also erased. If the type is a base for type variations, those variations lose their base.


void rename_color ( String old_name, String name, String theme_type )

Renames the Color at old_name to name if the theme has theme_type. If name is already taken, this method fails.


void rename_constant ( String old_name, String name, String theme_type )

Renames the constant at old_name to name if the theme has theme_type. If name is already taken, this method fails.


void rename_font ( String old_name, String name, String theme_type )

Renames the Font at old_name to name if the theme has theme_type. If name is already taken, this method fails.


void rename_icon ( String old_name, String name, String theme_type )

Renames the icon at old_name to name if the theme has theme_type. If name is already taken, this method fails.


void rename_stylebox ( String old_name, String name, String theme_type )

Renames StyleBox at old_name to name if the theme has theme_type. If name is already taken, this method fails.


void rename_theme_item ( DataType data_type, String old_name, String name, String 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.


void set_color ( String name, String theme_type, Color color )

Sets the theme's Color to color at name in theme_type.

Creates theme_type if the theme does not have it.


void set_constant ( String name, String theme_type, int constant )

Sets the theme's constant to constant at name in theme_type.

Creates theme_type if the theme does not have it.


void set_font ( String name, String theme_type, Font font )

Sets the theme's Font to font at name in theme_type.

Creates theme_type if the theme does not have it.


void set_icon ( String name, String theme_type, Texture texture )

Sets the theme's icon Texture to texture at name in theme_type.

Creates theme_type if the theme does not have it.


void set_stylebox ( String name, String theme_type, StyleBox texture )

Sets theme's StyleBox to stylebox at name in theme_type.

Creates theme_type if the theme does not have it.


void set_theme_item ( DataType data_type, String name, String theme_type, 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.


void set_type_variation ( String theme_type, String base_type )

Marks theme_type as a variation of base_type.

This adds theme_type as a suggested option for Control.theme_type_variation on a 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 the class of the Control, the whole chain is going to be suggested as options.

Note: Suggestions only show up if this theme resource is set as the project default theme. See ProjectSettings.gui/theme/custom.