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 godot.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.
Constructor
Variables
defaultFont:Font
The default font of this godot.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 godot.Theme.hasDefaultFont
to check if this value is valid.
Methods
clearColor(name:String, nodeType:String):Void
Clears the godot.Color
at name
if the theme has node_type
.
clearConstant(name:String, nodeType:String):Void
Clears the constant at name
if the theme has node_type
.
clearFont(name:String, nodeType:String):Void
Clears the godot.Font
at name
if the theme has node_type
.
clearStylebox(name:String, nodeType:String):Void
Clears godot.StyleBox
at name
if the theme has node_type
.
clearThemeItem(dataType:Theme_DataType, name:String, nodeType:String):Void
Clears the theme item of data_type
at name
if the theme has node_type
.
getColor(name:String, nodeType:String):Color
Returns the godot.Color
at name
if the theme has node_type
.
inlinegetColorList(nodeType:String):Array<String>
Returns all the godot.Color
s as a String
filled with each godot.Color
's name, for use in godot.Theme.getColor
, if the theme has node_type
.
inlinegetColorTypes():Array<String>
Returns all the godot.Color
types as a String
filled with unique type names, for use in godot.Theme.getColor
and/or godot.Theme.getColorList
.
getConstant(name:String, nodeType:String):Int
Returns the constant at name
if the theme has node_type
.
inlinegetConstantList(nodeType:String):Array<String>
Returns all the constants as a String
filled with each constant's name, for use in godot.Theme.getConstant
, if the theme has node_type
.
inlinegetConstantTypes():Array<String>
Returns all the constant types as a String
filled with unique type names, for use in godot.Theme.getConstant
and/or godot.Theme.getConstantList
.
getFont(name:String, nodeType:String):Font
Returns the godot.Font
at name
if the theme has node_type
.
inlinegetFontList(nodeType:String):Array<String>
Returns all the godot.Font
s as a String
filled with each godot.Font
's name, for use in godot.Theme.getFont
, if the theme has node_type
.
inlinegetFontTypes():Array<String>
Returns all the godot.Font
types as a String
filled with unique type names, for use in godot.Theme.getFont
and/or godot.Theme.getFontList
.
getIcon(name:String, nodeType:String):Texture
Returns the icon godot.Texture
at name
if the theme has node_type
.
inlinegetIconList(nodeType:String):Array<String>
Returns all the icons as a String
filled with each godot.Texture
's name, for use in godot.Theme.getIcon
, if the theme has node_type
.
inlinegetIconTypes():Array<String>
Returns all the icon types as a String
filled with unique type names, for use in godot.Theme.getIcon
and/or godot.Theme.getIconList
.
getStylebox(name:String, nodeType:String):StyleBox
Returns the godot.StyleBox
at name
if the theme has node_type
.
Valid name
s may be found using godot.Theme.getStyleboxList
. Valid node_type
s may be found using godot.Theme.getStyleboxTypes
.
inlinegetStyleboxList(nodeType:String):Array<String>
Returns all the godot.StyleBox
s as a String
filled with each godot.StyleBox
's name, for use in godot.Theme.getStylebox
, if the theme has node_type
.
Valid node_type
s may be found using godot.Theme.getStyleboxTypes
.
inlinegetStyleboxTypes():Array<String>
Returns all the godot.StyleBox
types as a String
filled with unique type names, for use in godot.Theme.getStylebox
and/or godot.Theme.getStyleboxList
.
getThemeItem(dataType:Theme_DataType, name:String, nodeType:String):Dynamic
Returns the theme item of data_type
at name
if the theme has node_type
.
Valid name
s may be found using godot.Theme.getThemeItemList
or a data type specific method. Valid node_type
s may be found using godot.Theme.getThemeItemTypes
or a data type specific method.
inlinegetThemeItemList(dataType:Theme_DataType, nodeType:String):Array<String>
Returns all the theme items of data_type
as a String
filled with each theme items's name, for use in godot.Theme.getThemeItem
or a data type specific method, if the theme has node_type
.
Valid node_type
s may be found using godot.Theme.getThemeItemTypes
or a data type specific method.
inlinegetThemeItemTypes(dataType:Theme_DataType):Array<String>
Returns all the theme items of data_type
types as a String
filled with unique type names, for use in godot.Theme.getThemeItem
, godot.Theme.getThemeItemList
or data type specific methods.
inlinegetTypeList(nodeType:String):Array<String>
Returns all the theme types as a String
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.
hasColor(name:String, nodeType:String):Bool
Returns true
if godot.Color
with name
is in node_type
.
Returns false
if the theme does not have node_type
.
hasConstant(name:String, nodeType:String):Bool
Returns true
if constant with name
is in node_type
.
Returns false
if the theme does not have node_type
.
hasFont(name:String, nodeType:String):Bool
Returns true
if godot.Font
with name
is in node_type
.
Returns false
if the theme does not have node_type
.
hasIcon(name:String, nodeType:String):Bool
Returns true
if icon godot.Texture
with name
is in node_type
.
Returns false
if the theme does not have node_type
.
hasStylebox(name:String, nodeType:String):Bool
Returns true
if godot.StyleBox
with name
is in node_type
.
Returns false
if the theme does not have node_type
.
hasThemeItem(dataType:Theme_DataType, name:String, nodeType:String):Bool
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
.
mergeWith(other:Theme):Void
Adds missing and overrides existing definitions with values from the other
godot.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.
renameColor(oldName:String, name:String, nodeType:String):Void
Renames the godot.Color
at old_name
to name
if the theme has node_type
. If name
is already taken, this method fails.
renameConstant(oldName:String, name:String, nodeType:String):Void
Renames the constant at old_name
to name
if the theme has node_type
. If name
is already taken, this method fails.
renameFont(oldName:String, name:String, nodeType:String):Void
Renames the godot.Font
at old_name
to name
if the theme has node_type
. If name
is already taken, this method fails.
renameIcon(oldName:String, name:String, nodeType:String):Void
Renames the icon at old_name
to name
if the theme has node_type
. If name
is already taken, this method fails.
renameStylebox(oldName:String, name:String, nodeType:String):Void
Renames godot.StyleBox
at old_name
to name
if the theme has node_type
. If name
is already taken, this method fails.
renameThemeItem(dataType:Theme_DataType, oldName:String, name:String, nodeType:String):Void
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.
setColor(name:String, nodeType:String, color:Color):Void
Sets the theme's godot.Color
to color
at name
in node_type
.
Creates node_type
if the theme does not have it.
setConstant(name:String, nodeType:String, constant:Int):Void
Sets the theme's constant to constant
at name
in node_type
.
Creates node_type
if the theme does not have it.
setFont(name:String, nodeType:String, font:Font):Void
Sets the theme's godot.Font
to font
at name
in node_type
.
Creates node_type
if the theme does not have it.
setIcon(name:String, nodeType:String, texture:Texture):Void
Sets the theme's icon godot.Texture
to texture
at name
in node_type
.
Creates node_type
if the theme does not have it.
setStylebox(name:String, nodeType:String, texture:StyleBox):Void
Sets theme's godot.StyleBox
to stylebox
at name
in node_type
.
Creates node_type
if the theme does not have it.
setThemeItem(dataType:Theme_DataType, name:String, nodeType:String, value:Dynamic):Void
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.