Documentation
¶
Overview ¶
A resource used for styling/skinning graphics.gd/classdb/Control and graphics.gd/classdb/Window nodes. While individual controls can be styled using their local theme overrides (see graphics.gd/classdb/Control.Instance.AddThemeColorOverride), theme resources allow you to store and apply the same settings across all controls sharing the same type (e.g. style all [graphics.gd/classdb/Button]s 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 graphics.gd/classdb/ProjectSettings "gui/theme/custom" to set up a project-scope theme that will be available to every control in your project.
Use graphics.gd/classdb/Control.Instance.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.
Index ¶
- type Advanced
- type Any
- type DataType
- type Extension
- type ID
- type Instance
- func (self Instance) AddType(theme_type string)
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) AsTheme() Instance
- func (self Instance) Clear()
- func (self Instance) ClearColor(name string, theme_type string)
- func (self Instance) ClearConstant(name string, theme_type string)
- func (self Instance) ClearFont(name string, theme_type string)
- func (self Instance) ClearFontSize(name string, theme_type string)
- func (self Instance) ClearIcon(name string, theme_type string)
- func (self Instance) ClearStylebox(name string, theme_type string)
- func (self Instance) ClearThemeItem(data_type DataType, name string, theme_type string)
- func (self Instance) ClearTypeVariation(theme_type string)
- func (self Instance) DefaultBaseScale() Float.X
- func (self Instance) DefaultFont() Font.Instance
- func (self Instance) DefaultFontSize() int
- func (self Instance) GetColor(name string, theme_type string) Color.RGBA
- func (self Instance) GetColorList(theme_type string) []string
- func (self Instance) GetColorTypeList() []string
- func (self Instance) GetConstant(name string, theme_type string) int
- func (self Instance) GetConstantList(theme_type string) []string
- func (self Instance) GetConstantTypeList() []string
- func (self Instance) GetFont(name string, theme_type string) Font.Instance
- func (self Instance) GetFontList(theme_type string) []string
- func (self Instance) GetFontSize(name string, theme_type string) int
- func (self Instance) GetFontSizeList(theme_type string) []string
- func (self Instance) GetFontSizeTypeList() []string
- func (self Instance) GetFontTypeList() []string
- func (self Instance) GetIcon(name string, theme_type string) Texture2D.Instance
- func (self Instance) GetIconList(theme_type string) []string
- func (self Instance) GetIconTypeList() []string
- func (self Instance) GetStylebox(name string, theme_type string) StyleBox.Instance
- func (self Instance) GetStyleboxList(theme_type string) []string
- func (self Instance) GetStyleboxTypeList() []string
- func (self Instance) GetThemeItem(data_type DataType, name string, theme_type string) any
- func (self Instance) GetThemeItemList(data_type DataType, theme_type string) []string
- func (self Instance) GetThemeItemTypeList(data_type DataType) []string
- func (self Instance) GetTypeList() []string
- func (self Instance) GetTypeVariationBase(theme_type string) string
- func (self Instance) GetTypeVariationList(base_type string) []string
- func (self Instance) HasColor(name string, theme_type string) bool
- func (self Instance) HasConstant(name string, theme_type string) bool
- func (self Instance) HasDefaultBaseScale() bool
- func (self Instance) HasDefaultFont() bool
- func (self Instance) HasDefaultFontSize() bool
- func (self Instance) HasFont(name string, theme_type string) bool
- func (self Instance) HasFontSize(name string, theme_type string) bool
- func (self Instance) HasIcon(name string, theme_type string) bool
- func (self Instance) HasStylebox(name string, theme_type string) bool
- func (self Instance) HasThemeItem(data_type DataType, name string, theme_type string) bool
- func (self Instance) ID() ID
- func (self Instance) IsTypeVariation(theme_type string, base_type string) bool
- func (self Instance) MergeWith(other Instance)
- func (self Instance) RemoveType(theme_type string)
- func (self Instance) RenameColor(old_name string, name string, theme_type string)
- func (self Instance) RenameConstant(old_name string, name string, theme_type string)
- func (self Instance) RenameFont(old_name string, name string, theme_type string)
- func (self Instance) RenameFontSize(old_name string, name string, theme_type string)
- func (self Instance) RenameIcon(old_name string, name string, theme_type string)
- func (self Instance) RenameStylebox(old_name string, name string, theme_type string)
- func (self Instance) RenameThemeItem(data_type DataType, old_name string, name string, theme_type string)
- func (self Instance) RenameType(old_theme_type string, theme_type string)
- func (self Instance) SetColor(name string, theme_type string, color Color.RGBA)
- func (self Instance) SetConstant(name string, theme_type string, constant int)
- func (self Instance) SetDefaultBaseScale(value Float.X)
- func (self Instance) SetDefaultFont(value Font.Instance)
- func (self Instance) SetDefaultFontSize(value int)
- func (self Instance) SetFont(name string, theme_type string, font Font.Instance)
- func (self Instance) SetFontSize(name string, theme_type string, font_size int)
- func (self Instance) SetIcon(name string, theme_type string, texture Texture2D.Instance)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetStylebox(name string, theme_type string, texture StyleBox.Instance)
- func (self Instance) SetThemeItem(data_type DataType, name string, theme_type string, value any)
- func (self Instance) SetTypeVariation(theme_type string, base_type string)
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type DataType ¶
type DataType int //gd:Theme.DataType
const ( // Theme's [Color.RGBA] item type. DataTypeColor DataType = 0 // Theme's constant item type. DataTypeConstant DataType = 1 // Theme's [graphics.gd/classdb/Font] item type. DataTypeFont DataType = 2 // Theme's font size item type. DataTypeFontSize DataType = 3 // Theme's icon [graphics.gd/classdb/Texture2D] item type. DataTypeIcon DataType = 4 // Theme's [graphics.gd/classdb/StyleBox] item type. DataTypeStylebox DataType = 5 // Maximum value for the DataType enum. DataTypeMax DataType = 6 )
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddType ¶
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.
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) Clear ¶
func (self Instance) Clear()
Removes all the theme properties defined on the theme resource.
func (Instance) ClearColor ¶
Removes the [Color.RGBA] property defined by 'name' and 'theme_type', if it exists.
Fails if it doesn't exist. Use Instance.HasColor to check for existence.
func (Instance) ClearConstant ¶
Removes the constant property defined by 'name' and 'theme_type', if it exists.
Fails if it doesn't exist. Use Instance.HasConstant to check for existence.
func (Instance) ClearFont ¶
Removes the graphics.gd/classdb/Font property defined by 'name' and 'theme_type', if it exists.
Fails if it doesn't exist. Use Instance.HasFont to check for existence.
func (Instance) ClearFontSize ¶
Removes the font size property defined by 'name' and 'theme_type', if it exists.
Fails if it doesn't exist. Use Instance.HasFontSize to check for existence.
func (Instance) ClearIcon ¶
Removes the icon property defined by 'name' and 'theme_type', if it exists.
Fails if it doesn't exist. Use Instance.HasIcon to check for existence.
func (Instance) ClearStylebox ¶
Removes the graphics.gd/classdb/StyleBox property defined by 'name' and 'theme_type', if it exists.
Fails if it doesn't exist. Use Instance.HasStylebox to check for existence.
func (Instance) ClearThemeItem ¶
Removes the theme property of 'data_type' defined by 'name' and 'theme_type', if it exists.
Fails if it doesn't exist. Use Instance.HasThemeItem to check for existence.
Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.
func (Instance) ClearTypeVariation ¶
Unmarks 'theme_type' as being a variation of another theme type. See Instance.SetTypeVariation.
func (Instance) DefaultBaseScale ¶
func (Instance) DefaultFont ¶
func (Instance) DefaultFontSize ¶
func (Instance) GetColor ¶
Returns the [Color.RGBA] property defined by 'name' and 'theme_type', if it exists.
Returns the default color value if the property doesn't exist. Use Instance.HasColor to check for existence.
func (Instance) GetColorList ¶
Returns a list of names for [Color.RGBA] properties defined with 'theme_type'. Use Instance.GetColorTypeList to get a list of possible theme type names.
func (Instance) GetColorTypeList ¶
Returns a list of all unique theme type names for [Color.RGBA] properties. Use Instance.GetTypeList to get a list of all unique theme types.
func (Instance) GetConstant ¶
Returns the constant property defined by 'name' and 'theme_type', if it exists.
Returns 0 if the property doesn't exist. Use Instance.HasConstant to check for existence.
func (Instance) GetConstantList ¶
Returns a list of names for constant properties defined with 'theme_type'. Use Instance.GetConstantTypeList to get a list of possible theme type names.
func (Instance) GetConstantTypeList ¶
Returns a list of all unique theme type names for constant properties. Use Instance.GetTypeList to get a list of all unique theme types.
func (Instance) GetFont ¶
Returns the graphics.gd/classdb/Font property defined by 'name' and 'theme_type', if it exists.
Returns the default theme font if the property doesn't exist and the default theme font is set up (see Instance.DefaultFont). Use Instance.HasFont to check for existence of the property and Instance.HasDefaultFont to check for existence of the default theme font.
Returns the engine fallback font value, if neither exist (see graphics.gd/classdb/ThemeDB.FallbackFont).
func (Instance) GetFontList ¶
Returns a list of names for graphics.gd/classdb/Font properties defined with 'theme_type'. Use Instance.GetFontTypeList to get a list of possible theme type names.
func (Instance) GetFontSize ¶
Returns the font size property defined by 'name' and 'theme_type', if it exists.
Returns the default theme font size if the property doesn't exist and the default theme font size is set up (see Instance.DefaultFontSize). Use Instance.HasFontSize to check for existence of the property and Instance.HasDefaultFontSize to check for existence of the default theme font.
Returns the engine fallback font size value, if neither exist (see graphics.gd/classdb/ThemeDB.FallbackFontSize).
func (Instance) GetFontSizeList ¶
Returns a list of names for font size properties defined with 'theme_type'. Use Instance.GetFontSizeTypeList to get a list of possible theme type names.
func (Instance) GetFontSizeTypeList ¶
Returns a list of all unique theme type names for font size properties. Use Instance.GetTypeList to get a list of all unique theme types.
func (Instance) GetFontTypeList ¶
Returns a list of all unique theme type names for graphics.gd/classdb/Font properties. Use Instance.GetTypeList to get a list of all unique theme types.
func (Instance) GetIcon ¶
Returns the icon property defined by 'name' and 'theme_type', if it exists.
Returns the engine fallback icon value if the property doesn't exist (see graphics.gd/classdb/ThemeDB.FallbackIcon). Use Instance.HasIcon to check for existence.
func (Instance) GetIconList ¶
Returns a list of names for icon properties defined with 'theme_type'. Use Instance.GetIconTypeList to get a list of possible theme type names.
func (Instance) GetIconTypeList ¶
Returns a list of all unique theme type names for icon properties. Use Instance.GetTypeList to get a list of all unique theme types.
func (Instance) GetStylebox ¶
Returns the graphics.gd/classdb/StyleBox property defined by 'name' and 'theme_type', if it exists.
Returns the engine fallback stylebox value if the property doesn't exist (see graphics.gd/classdb/ThemeDB.FallbackStylebox). Use Instance.HasStylebox to check for existence.
func (Instance) GetStyleboxList ¶
Returns a list of names for graphics.gd/classdb/StyleBox properties defined with 'theme_type'. Use Instance.GetStyleboxTypeList to get a list of possible theme type names.
func (Instance) GetStyleboxTypeList ¶
Returns a list of all unique theme type names for graphics.gd/classdb/StyleBox properties. Use Instance.GetTypeList to get a list of all unique theme types.
func (Instance) GetThemeItem ¶
Returns the theme property of 'data_type' defined by 'name' and 'theme_type', if it exists.
Returns the engine fallback value if the property doesn't exist (see graphics.gd/classdb/ThemeDB). Use Instance.HasThemeItem to check for existence.
Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.
func (Instance) GetThemeItemList ¶
Returns a list of names for properties of 'data_type' defined with 'theme_type'. Use Instance.GetThemeItemTypeList to get a list of possible theme type names.
Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.
func (Instance) GetThemeItemTypeList ¶
Returns a list of all unique theme type names for 'data_type' properties. Use Instance.GetTypeList to get a list of all unique theme types.
Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.
func (Instance) GetTypeList ¶
Returns a list of all unique theme type names. Use the appropriate get_*_type_list method to get a list of unique theme types for a single data type.
func (Instance) GetTypeVariationBase ¶
Returns the name of the base theme type if 'theme_type' is a valid variation type. Returns an empty string otherwise.
func (Instance) GetTypeVariationList ¶
Returns a list of all type variations for the given 'base_type'.
func (Instance) HasColor ¶
Returns true if the [Color.RGBA] property defined by 'name' and 'theme_type' exists.
Returns false if it doesn't exist. Use Instance.SetColor to define it.
func (Instance) HasConstant ¶
Returns true if the constant property defined by 'name' and 'theme_type' exists.
Returns false if it doesn't exist. Use Instance.SetConstant to define it.
func (Instance) HasDefaultBaseScale ¶
Returns true if Instance.DefaultBaseScale has a valid value.
Returns false if it doesn't. The value must be greater than 0.0 to be considered valid.
func (Instance) HasDefaultFont ¶
Returns true if Instance.DefaultFont has a valid value.
Returns false if it doesn't.
func (Instance) HasDefaultFontSize ¶
Returns true if Instance.DefaultFontSize has a valid value.
Returns false if it doesn't. The value must be greater than 0 to be considered valid.
func (Instance) HasFont ¶
Returns true if the graphics.gd/classdb/Font property defined by 'name' and 'theme_type' exists, or if the default theme font is set up (see Instance.HasDefaultFont).
Returns false if neither exist. Use Instance.SetFont to define the property.
func (Instance) HasFontSize ¶
Returns true if the font size property defined by 'name' and 'theme_type' exists, or if the default theme font size is set up (see Instance.HasDefaultFontSize).
Returns false if neither exist. Use Instance.SetFontSize to define the property.
func (Instance) HasIcon ¶
Returns true if the icon property defined by 'name' and 'theme_type' exists.
Returns false if it doesn't exist. Use Instance.SetIcon to define it.
func (Instance) HasStylebox ¶
Returns true if the graphics.gd/classdb/StyleBox property defined by 'name' and 'theme_type' exists.
Returns false if it doesn't exist. Use Instance.SetStylebox to define it.
func (Instance) HasThemeItem ¶
Returns true if the theme property of 'data_type' defined by 'name' and 'theme_type' exists.
Returns false if it doesn't exist. Use Instance.SetThemeItem to define it.
Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.
func (Instance) IsTypeVariation ¶
Returns true if 'theme_type' is marked as a variation of 'base_type'.
func (Instance) MergeWith ¶
Adds missing and overrides existing definitions with values from the 'other' theme resource.
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.
func (Instance) RemoveType ¶
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.
func (Instance) RenameColor ¶
Renames the [Color.RGBA] property defined by 'old_name' and 'theme_type' to 'name', if it exists.
Fails if it doesn't exist, or if a similar property with the new name already exists. Use Instance.HasColor to check for existence, and Instance.ClearColor to remove the existing property.
func (Instance) RenameConstant ¶
Renames the constant property defined by 'old_name' and 'theme_type' to 'name', if it exists.
Fails if it doesn't exist, or if a similar property with the new name already exists. Use Instance.HasConstant to check for existence, and Instance.ClearConstant to remove the existing property.
func (Instance) RenameFont ¶
Renames the graphics.gd/classdb/Font property defined by 'old_name' and 'theme_type' to 'name', if it exists.
Fails if it doesn't exist, or if a similar property with the new name already exists. Use Instance.HasFont to check for existence, and Instance.ClearFont to remove the existing property.
func (Instance) RenameFontSize ¶
Renames the font size property defined by 'old_name' and 'theme_type' to 'name', if it exists.
Fails if it doesn't exist, or if a similar property with the new name already exists. Use Instance.HasFontSize to check for existence, and Instance.ClearFontSize to remove the existing property.
func (Instance) RenameIcon ¶
Renames the icon property defined by 'old_name' and 'theme_type' to 'name', if it exists.
Fails if it doesn't exist, or if a similar property with the new name already exists. Use Instance.HasIcon to check for existence, and Instance.ClearIcon to remove the existing property.
func (Instance) RenameStylebox ¶
Renames the graphics.gd/classdb/StyleBox property defined by 'old_name' and 'theme_type' to 'name', if it exists.
Fails if it doesn't exist, or if a similar property with the new name already exists. Use Instance.HasStylebox to check for existence, and Instance.ClearStylebox to remove the existing property.
func (Instance) RenameThemeItem ¶
func (self Instance) RenameThemeItem(data_type DataType, old_name string, name string, theme_type string)
Renames the theme property of 'data_type' defined by 'old_name' and 'theme_type' to 'name', if it exists.
Fails if it doesn't exist, or if a similar property with the new name already exists. Use Instance.HasThemeItem to check for existence, and Instance.ClearThemeItem to remove the existing property.
Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.
func (Instance) RenameType ¶
Renames the theme type 'old_theme_type' to 'theme_type', if the old type exists and the new one doesn't exist.
Note: Renaming a theme type to an empty name or a variation to a type associated with a built-in class removes type variation connections in a way that cannot be undone by reversing the rename alone.
func (Instance) SetColor ¶
Creates or changes the value of the [Color.RGBA] property defined by 'name' and 'theme_type'. Use Instance.ClearColor to remove the property.
func (Instance) SetConstant ¶
Creates or changes the value of the constant property defined by 'name' and 'theme_type'. Use Instance.ClearConstant to remove the property.
func (Instance) SetDefaultBaseScale ¶
func (Instance) SetDefaultFont ¶
func (Instance) SetDefaultFontSize ¶
func (Instance) SetFont ¶
Creates or changes the value of the graphics.gd/classdb/Font property defined by 'name' and 'theme_type'. Use Instance.ClearFont to remove the property.
func (Instance) SetFontSize ¶
Creates or changes the value of the font size property defined by 'name' and 'theme_type'. Use Instance.ClearFontSize to remove the property.
func (Instance) SetIcon ¶
Creates or changes the value of the icon property defined by 'name' and 'theme_type'. Use Instance.ClearIcon to remove the property.
func (Instance) SetStylebox ¶
Creates or changes the value of the graphics.gd/classdb/StyleBox property defined by 'name' and 'theme_type'. Use Instance.ClearStylebox to remove the property.
func (Instance) SetThemeItem ¶
Creates or changes the value of the theme property of 'data_type' defined by 'name' and 'theme_type'. Use Instance.ClearThemeItem to remove the property.
Fails if the 'value' type is not accepted by 'data_type'.
Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.
func (Instance) SetTypeVariation ¶
Marks 'theme_type' as a variation of 'base_type'.
This adds 'theme_type' as a suggested option for graphics.gd/classdb/Control.Instance.ThemeTypeVariation on a graphics.gd/classdb/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 graphics.gd/classdb/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 graphics.gd/classdb/ProjectSettings "gui/theme/custom".