Inheritance #

RefCounted

- AESContext
- AStar2D
- AStar3D
- AStarGrid2D
- AudioEffectInstance (1)
- AudioSample
- AudioSamplePlayback
- AudioStreamPlayback (5)
- CameraFeed
- CharFXTransform
- ConfigFile
- Crypto
- DTLSServer
- DirAccess
- ENetConnection
- EditorContextMenuPlugin
- EditorDebuggerPlugin
- EditorDebuggerSession
- EditorExportPlatform (6)
- EditorExportPlugin
- EditorExportPreset
- EditorFeatureProfile
- EditorFileSystemImportFormatSupportQuery
- EditorInspectorPlugin
- EditorResourceConversionPlugin
- EditorResourcePreviewGenerator
- EditorResourceTooltipPlugin
- EditorSceneFormatImporter (4)
- EditorScenePostImport
- EditorScenePostImportPlugin
- EditorScript
- EditorTranslationParserPlugin
- EncodedObjectAsID
- EngineProfiler
- Expression
- FileAccess
- GLTFObjectModelProperty
- HMACContext
- HTTPClient
- HashingContext
- ImageFormatLoader (1)
- JavaClass
- JavaObject
- JavaScriptObject
- KinematicCollision2D
- KinematicCollision3D
- Lightmapper (1)
- MeshConvexDecompositionSettings
- MeshDataTool
- MultiplayerAPI (2)
- Mutex
- NavigationPathQueryParameters2D
- NavigationPathQueryParameters3D
- NavigationPathQueryResult2D
- NavigationPathQueryResult3D
- Node3DGizmo (1)
- OggPacketSequencePlayback
- OpenXRAPIExtension
- PCKPacker
- PackedDataContainerRef
- PacketPeer (8)
- PhysicsPointQueryParameters2D
- PhysicsPointQueryParameters3D
- PhysicsRayQueryParameters2D
- PhysicsRayQueryParameters3D
- PhysicsShapeQueryParameters2D
- PhysicsShapeQueryParameters3D
- PhysicsTestMotionParameters2D
- PhysicsTestMotionParameters3D
- PhysicsTestMotionResult2D
- PhysicsTestMotionResult3D
- RDAttachmentFormat
- RDFramebufferPass
- RDPipelineColorBlendState
- RDPipelineColorBlendStateAttachment
- RDPipelineDepthStencilState
- RDPipelineMultisampleState
- RDPipelineRasterizationState
- RDPipelineSpecializationConstant
- RDSamplerState
- RDShaderSource
- RDTextureFormat
- RDTextureView
- RDUniform
- RDVertexAttribute
- RandomNumberGenerator
- RegEx
- RegExMatch
- RenderSceneBuffers (2)
- RenderSceneBuffersConfiguration
- Resource (103)
- ResourceFormatLoader
- ResourceFormatSaver
- ResourceImporter (16)
- SceneState
- SceneTreeTimer
- Semaphore
- SkinReference
- StreamPeer (5)
- SurfaceTool
- TCPServer
- TLSOptions
- TextLine
- TextParagraph
- TextServer (1)
- Thread
- TranslationDomain
- TriangleMesh
- Tween
- Tweener (5)
- UDPServer
- UPNP
- UPNPDevice
- WeakRef
- WebRTCPeerConnection (1)
- XMLParser
- XRInterface (4)
- XRPose
- XRTracker (2)
- ZIPPacker
- ZIPReader
Resource

- Animation
- AnimationLibrary
- AnimationNode (6)
- AnimationNodeStateMachinePlayback
- AnimationNodeStateMachineTransition
- AudioBusLayout
- AudioEffect (17)
- AudioStream (10)
- BitMap
- BoneMap
- ButtonGroup
- CameraAttributes (2)
- ColorPalette
- Compositor
- CompositorEffect
- CryptoKey
- Curve
- Curve2D
- Curve3D
- EditorNode3DGizmoPlugin
- EditorSettings
- Environment
- Font (3)
- GDExtension
- GLTFAccessor
- GLTFAnimation
- GLTFBufferView
- GLTFCamera
- GLTFDocument (1)
- GLTFDocumentExtension (1)
- GLTFLight
- GLTFMesh
- GLTFNode
- GLTFPhysicsBody
- GLTFPhysicsShape
- GLTFSkeleton
- GLTFSkin
- GLTFSpecGloss
- GLTFState (1)
- GLTFTexture
- GLTFTextureSampler
- Gradient
- Image
- ImporterMesh
- InputEvent (6)
- JSON
- LabelSettings
- LightmapGIData
- Material (9)
- Mesh (4)
- MeshLibrary
- MissingResource
- MultiMesh
- NavigationMesh
- NavigationMeshSourceGeometryData2D
- NavigationMeshSourceGeometryData3D
- NavigationPolygon
- Noise (1)
- Occluder3D (5)
- OccluderPolygon2D
- OggPacketSequence
- OpenXRAction
- OpenXRActionMap
- OpenXRActionSet
- OpenXRBindingModifier (2)
- OpenXRHapticBase (1)
- OpenXRIPBinding
- OpenXRInteractionProfile
- PackedDataContainer
- PackedScene
- PhysicsMaterial
- PolygonPathFinder
- RDShaderFile
- RDShaderSPIRV
- RichTextEffect
- SceneReplicationConfig
- Script (3)
- Shader (1)
- ShaderInclude
- Shape2D (8)
- Shape3D (9)
- Shortcut
- SkeletonModification2D (7)
- SkeletonModificationStack2D
- SkeletonProfile (1)
- Skin
- Sky
- SpriteFrames
- StyleBox (4)
- SyntaxHighlighter (2)
- Texture (3)
- Theme
- TileMapPattern
- TileSet
- TileSetSource (2)
- Translation (1)
- VideoStream (1)
- VideoStreamPlayback
- VisualShaderNode (62)
- VoxelGIData
- World2D
- World3D
- X509Certificate
Theme
Table of contents

Theme #

is_refcounted, is_instantiable, resource, core, not_builtin_classes

A resource used for styling/skinning Controls and Windows.

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.

Members #

var default_base_scale: float = 0.0#

The default base scale factor of this theme resource. Used by some controls to scale their visual properties based on the global scale factor. If this value is set to 0.0, the global scale factor is used (see ThemeDB.fallback_base_scale).

Use has_default_base_scale to check if this value is valid.

var default_font: Font#

The default font of this theme resource. Used as the default value when trying to fetch a font resource that doesn't exist in this theme or is in invalid state. If the default font is also missing or invalid, the engine fallback value is used (see ThemeDB.fallback_font).

Use has_default_font to check if this value is valid.

var default_font_size: int = -1#

The default font size of this theme resource. Used as the default value when trying to fetch a font size value that doesn't exist in this theme or is in invalid state. If the default font size is also missing or invalid, the engine fallback value is used (see ThemeDB.fallback_font_size).

Values below 1 are invalid and can be used to unset the property. Use has_default_font_size to check if this value is valid.

Methods #

func add_type(theme_type: StringName) -> void#

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 clear() -> void#

Removes all the theme properties defined on the theme resource.

func clear_color(theme_type: StringName) -> void#

Removes the Color property defined by name and theme_type, if it exists.

Fails if it doesn't exist. Use has_color to check for existence.

func clear_constant(theme_type: StringName) -> void#

Removes the constant property defined by name and theme_type, if it exists.

Fails if it doesn't exist. Use has_constant to check for existence.

func clear_font(theme_type: StringName) -> void#

Removes the Font property defined by name and theme_type, if it exists.

Fails if it doesn't exist. Use has_font to check for existence.

func clear_font_size(theme_type: StringName) -> void#

Removes the font size property defined by name and theme_type, if it exists.

Fails if it doesn't exist. Use has_font_size to check for existence.

func clear_icon(theme_type: StringName) -> void#

Removes the icon property defined by name and theme_type, if it exists.

Fails if it doesn't exist. Use has_icon to check for existence.

func clear_stylebox(theme_type: StringName) -> void#

Removes the StyleBox property defined by name and theme_type, if it exists.

Fails if it doesn't exist. Use has_stylebox to check for existence.

func clear_theme_item(theme_type: StringName) -> void#

Removes the theme property of data_type defined by name and theme_type, if it exists.

Fails if it doesn't exist. Use has_theme_item 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 clear_type_variation(theme_type: StringName) -> void#

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

const func get_color(theme_type: StringName) -> Color#

Returns the Color property defined by name and theme_type, if it exists.

Returns the default color value if the property doesn't exist. Use has_color to check for existence.

const func get_color_list(theme_type: String) -> PackedStringArray#

Returns a list of names for Color properties defined with theme_type. Use get_color_type_list to get a list of possible theme type names.

const func get_color_type_list() -> PackedStringArray#

Returns a list of all unique theme type names for Color properties. Use get_type_list to get a list of all unique theme types.

const func get_constant(theme_type: StringName) -> int#

Returns the constant property defined by name and theme_type, if it exists.

Returns 0 if the property doesn't exist. Use has_constant to check for existence.

const func get_constant_list(theme_type: String) -> PackedStringArray#

Returns a list of names for constant properties defined with theme_type. Use get_constant_type_list to get a list of possible theme type names.

const func get_constant_type_list() -> PackedStringArray#

Returns a list of all unique theme type names for constant properties. Use get_type_list to get a list of all unique theme types.

const func get_font(theme_type: StringName) -> Font#

Returns the 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 default_font). Use has_font to check for existence of the property and has_default_font to check for existence of the default theme font.

Returns the engine fallback font value, if neither exist (see ThemeDB.fallback_font).

const func get_font_list(theme_type: String) -> PackedStringArray#

Returns a list of names for Font properties defined with theme_type. Use get_font_type_list to get a list of possible theme type names.

const func get_font_size(theme_type: StringName) -> int#

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 default_font_size). Use has_font_size to check for existence of the property and has_default_font_size to check for existence of the default theme font.

Returns the engine fallback font size value, if neither exist (see ThemeDB.fallback_font_size).

const func get_font_size_list(theme_type: String) -> PackedStringArray#

Returns a list of names for font size properties defined with theme_type. Use get_font_size_type_list to get a list of possible theme type names.

const func get_font_size_type_list() -> PackedStringArray#

Returns a list of all unique theme type names for font size properties. Use get_type_list to get a list of all unique theme types.

const func get_font_type_list() -> PackedStringArray#

Returns a list of all unique theme type names for Font properties. Use get_type_list to get a list of all unique theme types.

const func get_icon(theme_type: StringName) -> Texture2D#

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 ThemeDB.fallback_icon). Use has_icon to check for existence.

const func get_icon_list(theme_type: String) -> PackedStringArray#

Returns a list of names for icon properties defined with theme_type. Use get_icon_type_list to get a list of possible theme type names.

const func get_icon_type_list() -> PackedStringArray#

Returns a list of all unique theme type names for icon properties. Use get_type_list to get a list of all unique theme types.

const func get_stylebox(theme_type: StringName) -> StyleBox#

Returns the StyleBox property defined by name and theme_type, if it exists.

Returns the engine fallback stylebox value if the property doesn't exist (see ThemeDB.fallback_stylebox). Use has_stylebox to check for existence.

const func get_stylebox_list(theme_type: String) -> PackedStringArray#

Returns a list of names for StyleBox properties defined with theme_type. Use get_stylebox_type_list to get a list of possible theme type names.

const func get_stylebox_type_list() -> PackedStringArray#

Returns a list of all unique theme type names for StyleBox properties. Use get_type_list to get a list of all unique theme types.

const func get_theme_item(theme_type: StringName) -> Variant#

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 ThemeDB). Use has_theme_item 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.

const func get_theme_item_list(theme_type: String) -> PackedStringArray#

Returns a list of names for properties of data_type defined with theme_type. Use get_theme_item_type_list 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.

const func get_theme_item_type_list(data_type: int enumTheme.DataType) -> PackedStringArray#

Returns a list of all unique theme type names for data_type properties. Use get_type_list 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.

const func get_type_list() -> PackedStringArray#

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.

const func get_type_variation_base(theme_type: StringName) -> StringName#

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

const func get_type_variation_list(base_type: StringName) -> PackedStringArray#

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

const func has_color(theme_type: StringName) -> bool#

Returns true if the Color property defined by name and theme_type exists.

Returns false if it doesn't exist. Use set_color to define it.

const func has_constant(theme_type: StringName) -> bool#

Returns true if the constant property defined by name and theme_type exists.

Returns false if it doesn't exist. Use set_constant to define it.

const func has_default_base_scale() -> bool#

Returns true if default_base_scale has a valid value.

Returns false if it doesn't. The value must be greater than 0.0 to be considered valid.

const func has_default_font() -> bool#

Returns true if default_font has a valid value.

Returns false if it doesn't.

const func has_default_font_size() -> bool#

Returns true if default_font_size has a valid value.

Returns false if it doesn't. The value must be greater than 0 to be considered valid.

const func has_font(theme_type: StringName) -> bool#

Returns true if the Font property defined by name and theme_type exists, or if the default theme font is set up (see has_default_font).

Returns false if neither exist. Use set_font to define the property.

const func has_font_size(theme_type: StringName) -> bool#

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 has_default_font_size).

Returns false if neither exist. Use set_font_size to define the property.

const func has_icon(theme_type: StringName) -> bool#

Returns true if the icon property defined by name and theme_type exists.

Returns false if it doesn't exist. Use set_icon to define it.

const func has_stylebox(theme_type: StringName) -> bool#

Returns true if the StyleBox property defined by name and theme_type exists.

Returns false if it doesn't exist. Use set_stylebox to define it.

const func has_theme_item(theme_type: StringName) -> bool#

Returns true if the theme property of data_type defined by name and theme_type exists.

Returns false if it doesn't exist. Use set_theme_item to define it.

Note: This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.

const func is_type_variation(base_type: StringName) -> bool#

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

func merge_with(other: Theme) -> void#

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 remove_type(theme_type: StringName) -> void#

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 rename_color(theme_type: StringName) -> void#

Renames the Color 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 has_color to check for existence, and clear_color to remove the existing property.

func rename_constant(theme_type: StringName) -> void#

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 has_constant to check for existence, and clear_constant to remove the existing property.

func rename_font(theme_type: StringName) -> void#

Renames the 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 has_font to check for existence, and clear_font to remove the existing property.

func rename_font_size(theme_type: StringName) -> void#

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 has_font_size to check for existence, and clear_font_size to remove the existing property.

func rename_icon(theme_type: StringName) -> void#

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 has_icon to check for existence, and clear_icon to remove the existing property.

func rename_stylebox(theme_type: StringName) -> void#

Renames the 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 has_stylebox to check for existence, and clear_stylebox to remove the existing property.

func rename_theme_item(theme_type: StringName) -> void#

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 has_theme_item to check for existence, and clear_theme_item 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 set_color(color: Color) -> void#

Creates or changes the value of the Color property defined by name and theme_type. Use clear_color to remove the property.

func set_constant(constant: int) -> void#

Creates or changes the value of the constant property defined by name and theme_type. Use clear_constant to remove the property.

func set_font(font: Font) -> void#

Creates or changes the value of the Font property defined by name and theme_type. Use clear_font to remove the property.

func set_font_size(font_size: int) -> void#

Creates or changes the value of the font size property defined by name and theme_type. Use clear_font_size to remove the property.

func set_icon(texture: Texture2D) -> void#

Creates or changes the value of the icon property defined by name and theme_type. Use clear_icon to remove the property.

func set_stylebox(texture: StyleBox) -> void#

Creates or changes the value of the StyleBox property defined by name and theme_type. Use clear_stylebox to remove the property.

func set_theme_item(value: Variant) -> void#

Creates or changes the value of the theme property of data_type defined by name and theme_type. Use clear_theme_item 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 set_type_variation(base_type: StringName) -> void#

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.

Annotations #

Constants #

const DATA_TYPE_COLOR = 0 enum DataType#

Theme's Color item type.

const DATA_TYPE_CONSTANT = 1 enum DataType#

Theme's constant item type.

const DATA_TYPE_FONT = 2 enum DataType#

Theme's Font item type.

const DATA_TYPE_FONT_SIZE = 3 enum DataType#

Theme's font size item type.

const DATA_TYPE_ICON = 4 enum DataType#

Theme's icon Texture2D item type.

const DATA_TYPE_STYLEBOX = 5 enum DataType#

Theme's StyleBox item type.

const DATA_TYPE_MAX = 6 enum DataType#

Maximum value for the DataType enum.

Constructors #

Enums #

DataType#

enum DataType { DATA_TYPE_COLOR = 0, DATA_TYPE_CONSTANT = 1, DATA_TYPE_FONT = 2, DATA_TYPE_FONT_SIZE = 3, DATA_TYPE_ICON = 4, DATA_TYPE_STYLEBOX = 5, DATA_TYPE_MAX = 6, }

Operators #

Signals #

Theme Items #

Tutorials #