Theme

    Theme for controls.

    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 ; the Control and its children will automatically use it.

    Theme resources can alternatively be loaded by writing them in a file, see the documentation for more information.

    Tutorials

    Methods

    enum DataType:

    • DATA_TYPE_COLOR = 0 —- Theme’s item type.

    • DATA_TYPE_CONSTANT = 1 —- Theme’s constant item type.

    • DATA_TYPE_FONT = 2 —- Theme’s Font item type.

    • DATA_TYPE_ICON = 3 —- Theme’s icon item type.

    • DATA_TYPE_STYLEBOX = 4 —- Theme’s StyleBox item type.

    • DATA_TYPE_MAX = 5 —- Maximum value for the DataType enum.

    Property Descriptions

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

    • void add_type ( 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, theme_type )

    Clears the Color at name if the theme has node_type.


    • void clear_constant ( name, String theme_type )

    Clears the constant at name if the theme has node_type.


    • void clear_font ( name, String theme_type )

    Clears the at name if the theme has node_type.


    • void clear_icon ( String name, theme_type )

    Clears the icon at name if the theme has node_type.


    • void clear_stylebox ( String name, theme_type )

    Clears StyleBox at name if the theme has node_type.


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


    • void clear_type_variation ( theme_type )

    • 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.


    • get_color ( String name, theme_type ) const

    Returns the Color at name if the theme has node_type.


    • get_color_list ( String theme_type ) const

    Returns all the s as a PoolStringArray filled with each ‘s name, for use in get_color, if the theme has node_type.


    • get_color_types ( ) const

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


    • int get_constant ( name, String theme_type ) const

    Returns the constant at name if the theme has node_type.


    • get_constant_list ( String theme_type ) const

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


    • get_constant_types ( ) const

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


    • get_font ( String name, theme_type ) const

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


    Returns all the Fonts as a filled with each Font‘s name, for use in , if the theme has node_type.


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


    • get_icon ( String name, theme_type ) const

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


    • get_icon_list ( String theme_type ) const

    Returns all the icons as a filled with each Texture‘s name, for use in , if the theme has node_type.


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


    Returns the at name if the theme has node_type.

    Valid names may be found using get_stylebox_list. Valid node_types may be found using .


    Returns all the StyleBoxs as a filled with each StyleBox‘s name, for use in , if the theme has node_type.

    Valid node_types may be found using get_stylebox_types.


    • get_stylebox_types ( ) const

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


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

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

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


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

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


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


    • get_type_list ( String theme_type ) const

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

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


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


    Returns a list of all type variations for the given .


    Returns true if with name is in node_type.

    Returns false if the theme does not have node_type.


    • bool has_constant ( name, String theme_type ) const

    Returns true if constant with name is in node_type.

    Returns false if the theme does not have node_type.


    • has_default_font ( ) const

    Returns true if this theme has a valid default_font value.


    • has_font ( String name, theme_type ) const

    Returns true if Font with name is in node_type.

    Returns false if the theme does not have node_type.


    • has_icon ( String name, theme_type ) const

    Returns true if icon Texture with name is in node_type.

    Returns false if the theme does not have node_type.


    • has_stylebox ( String name, theme_type ) const

    Returns true if StyleBox with name is in node_type.

    Returns false if the theme does not have node_type.


    Returns true if a theme item of data_type with name is in node_type.

    Returns false if the theme does not have node_type.


    • is_type_variation ( String theme_type, 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 ( 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, name, String theme_type )

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


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

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


    • void rename_font ( old_name, String name, theme_type )

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


    • void rename_icon ( old_name, String name, theme_type )

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


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

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


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

    Renames the theme item of data_type at old_name to name if the theme has node_type. If name is already taken, this method fails.


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

    Sets the theme’s to color at name in node_type.

    Creates node_type if the theme does not have it.


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

    Sets the theme’s constant to constant at name in node_type.

    Creates node_type if the theme does not have it.


    • void set_font ( name, String theme_type, font )

    Sets the theme’s Font to font at name in node_type.

    Creates node_type if the theme does not have it.


    • void set_icon ( name, String theme_type, texture )

    Sets the theme’s icon Texture to texture at name in node_type.

    Creates node_type if the theme does not have it.


    • void set_stylebox ( name, String theme_type, texture )

    Sets theme’s StyleBox to stylebox at name in node_type.

    Creates node_type if the theme does not have it.


    Sets the theme item of data_type to value at name in node_type.

    Does nothing if the value type does not match data_type.

    Creates node_type if the theme does not have it.


    • void set_type_variation ( theme_type, String base_type )

    Marks theme_type as a variation of base_type.

    This adds theme_type as a suggested option for on a Control that is of the base_type class.

    Variations can also be nested, i.e. can be another variation. If a chain of variations ends with a base_type matching the class of the , 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.