Theme

package
v0.0.0-...-01268d7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package Theme provides methods for working with Theme object instances.

Index

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 Any

type Any interface {
	gd.IsClass
	AsTheme() Instance
}

type DataType

type DataType = gdclass.ThemeDataType //gd:Theme.DataType
const (
	/*Theme's [Color] item type.*/
	DataTypeColor DataType = 0
	/*Theme's constant item type.*/
	DataTypeConstant DataType = 1
	/*Theme's [Font] item type.*/
	DataTypeFont DataType = 2
	/*Theme's font size item type.*/
	DataTypeFontSize DataType = 3
	/*Theme's icon [Texture2D] item type.*/
	DataTypeIcon DataType = 4
	/*Theme's [StyleBox] item type.*/
	DataTypeStylebox DataType = 5
	/*Maximum value for the DataType enum.*/
	DataTypeMax DataType = 6
)

type Instance

type Instance [1]gdclass.Theme

A resource used for styling/skinning [Control] and [Window] nodes. While individual controls can be styled using their local theme overrides (see [method 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 [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 [member ProjectSettings.gui/theme/custom] to set up a project-scope theme that will be available to every control in your project. Use [member 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.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddType

func (self Instance) AddType(theme_type string)

Adds an empty theme type for every valid data type. [b]Note:[/b] Empty types are not saved with the theme. This method only exists to perform in-memory changes to the resource. Use available [code]set_*[/code] methods to add theme items.

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) AsTheme

func (self Instance) AsTheme() Instance

func (Instance) Clear

func (self Instance) Clear()

Removes all the theme properties defined on the theme resource.

func (Instance) ClearColor

func (self Instance) ClearColor(name string, theme_type string)

Removes the [Color] property defined by [param name] and [param theme_type], if it exists. Fails if it doesn't exist. Use [method has_color] to check for existence.

func (Instance) ClearConstant

func (self Instance) ClearConstant(name string, theme_type string)

Removes the constant property defined by [param name] and [param theme_type], if it exists. Fails if it doesn't exist. Use [method has_constant] to check for existence.

func (Instance) ClearFont

func (self Instance) ClearFont(name string, theme_type string)

Removes the [Font] property defined by [param name] and [param theme_type], if it exists. Fails if it doesn't exist. Use [method has_font] to check for existence.

func (Instance) ClearFontSize

func (self Instance) ClearFontSize(name string, theme_type string)

Removes the font size property defined by [param name] and [param theme_type], if it exists. Fails if it doesn't exist. Use [method has_font_size] to check for existence.

func (Instance) ClearIcon

func (self Instance) ClearIcon(name string, theme_type string)

Removes the icon property defined by [param name] and [param theme_type], if it exists. Fails if it doesn't exist. Use [method has_icon] to check for existence.

func (Instance) ClearStylebox

func (self Instance) ClearStylebox(name string, theme_type string)

Removes the [StyleBox] property defined by [param name] and [param theme_type], if it exists. Fails if it doesn't exist. Use [method has_stylebox] to check for existence.

func (Instance) ClearThemeItem

func (self Instance) ClearThemeItem(data_type gdclass.ThemeDataType, name string, theme_type string)

Removes the theme property of [param data_type] defined by [param name] and [param theme_type], if it exists. Fails if it doesn't exist. Use [method has_theme_item] to check for existence. [b]Note:[/b] This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.

func (Instance) ClearTypeVariation

func (self Instance) ClearTypeVariation(theme_type string)

Unmarks [param theme_type] as being a variation of another theme type. See [method set_type_variation].

func (Instance) DefaultBaseScale

func (self Instance) DefaultBaseScale() Float.X

func (Instance) DefaultFont

func (self Instance) DefaultFont() [1]gdclass.Font

func (Instance) DefaultFontSize

func (self Instance) DefaultFontSize() int

func (Instance) GetColor

func (self Instance) GetColor(name string, theme_type string) Color.RGBA

Returns the [Color] property defined by [param name] and [param theme_type], if it exists. Returns the default color value if the property doesn't exist. Use [method has_color] to check for existence.

func (Instance) GetColorList

func (self Instance) GetColorList(theme_type string) []string

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

func (Instance) GetColorTypeList

func (self Instance) GetColorTypeList() []string

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

func (Instance) GetConstant

func (self Instance) GetConstant(name string, theme_type string) int

Returns the constant property defined by [param name] and [param theme_type], if it exists. Returns [code]0[/code] if the property doesn't exist. Use [method has_constant] to check for existence.

func (Instance) GetConstantList

func (self Instance) GetConstantList(theme_type string) []string

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

func (Instance) GetConstantTypeList

func (self Instance) GetConstantTypeList() []string

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

func (Instance) GetFont

func (self Instance) GetFont(name string, theme_type string) [1]gdclass.Font

Returns the [Font] property defined by [param name] and [param 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 [member default_font]). Use [method has_font] to check for existence of the property and [method has_default_font] to check for existence of the default theme font. Returns the engine fallback font value, if neither exist (see [member ThemeDB.fallback_font]).

func (Instance) GetFontList

func (self Instance) GetFontList(theme_type string) []string

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

func (Instance) GetFontSize

func (self Instance) GetFontSize(name string, theme_type string) int

Returns the font size property defined by [param name] and [param 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 [member default_font_size]). Use [method has_font_size] to check for existence of the property and [method has_default_font_size] to check for existence of the default theme font. Returns the engine fallback font size value, if neither exist (see [member ThemeDB.fallback_font_size]).

func (Instance) GetFontSizeList

func (self Instance) GetFontSizeList(theme_type string) []string

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

func (Instance) GetFontSizeTypeList

func (self Instance) GetFontSizeTypeList() []string

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

func (Instance) GetFontTypeList

func (self Instance) GetFontTypeList() []string

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

func (Instance) GetIcon

func (self Instance) GetIcon(name string, theme_type string) [1]gdclass.Texture2D

Returns the icon property defined by [param name] and [param theme_type], if it exists. Returns the engine fallback icon value if the property doesn't exist (see [member ThemeDB.fallback_icon]). Use [method has_icon] to check for existence.

func (Instance) GetIconList

func (self Instance) GetIconList(theme_type string) []string

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

func (Instance) GetIconTypeList

func (self Instance) GetIconTypeList() []string

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

func (Instance) GetStylebox

func (self Instance) GetStylebox(name string, theme_type string) [1]gdclass.StyleBox

Returns the [StyleBox] property defined by [param name] and [param theme_type], if it exists. Returns the engine fallback stylebox value if the property doesn't exist (see [member ThemeDB.fallback_stylebox]). Use [method has_stylebox] to check for existence.

func (Instance) GetStyleboxList

func (self Instance) GetStyleboxList(theme_type string) []string

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

func (Instance) GetStyleboxTypeList

func (self Instance) GetStyleboxTypeList() []string

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

func (Instance) GetThemeItem

func (self Instance) GetThemeItem(data_type gdclass.ThemeDataType, name string, theme_type string) any

Returns the theme property of [param data_type] defined by [param name] and [param theme_type], if it exists. Returns the engine fallback value if the property doesn't exist (see [ThemeDB]). Use [method has_theme_item] to check for existence. [b]Note:[/b] This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.

func (Instance) GetThemeItemList

func (self Instance) GetThemeItemList(data_type gdclass.ThemeDataType, theme_type string) []string

Returns a list of names for properties of [param data_type] defined with [param theme_type]. Use [method get_theme_item_type_list] to get a list of possible theme type names. [b]Note:[/b] This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.

func (Instance) GetThemeItemTypeList

func (self Instance) GetThemeItemTypeList(data_type gdclass.ThemeDataType) []string

Returns a list of all unique theme type names for [param data_type] properties. Use [method get_type_list] to get a list of all unique theme types. [b]Note:[/b] This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.

func (Instance) GetTypeList

func (self Instance) GetTypeList() []string

Returns a list of all unique theme type names. Use the appropriate [code]get_*_type_list[/code] method to get a list of unique theme types for a single data type.

func (Instance) GetTypeVariationBase

func (self Instance) GetTypeVariationBase(theme_type string) string

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

func (Instance) GetTypeVariationList

func (self Instance) GetTypeVariationList(base_type string) []string

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

func (Instance) HasColor

func (self Instance) HasColor(name string, theme_type string) bool

Returns [code]true[/code] if the [Color] property defined by [param name] and [param theme_type] exists. Returns [code]false[/code] if it doesn't exist. Use [method set_color] to define it.

func (Instance) HasConstant

func (self Instance) HasConstant(name string, theme_type string) bool

Returns [code]true[/code] if the constant property defined by [param name] and [param theme_type] exists. Returns [code]false[/code] if it doesn't exist. Use [method set_constant] to define it.

func (Instance) HasDefaultBaseScale

func (self Instance) HasDefaultBaseScale() bool

Returns [code]true[/code] if [member default_base_scale] has a valid value. Returns [code]false[/code] if it doesn't. The value must be greater than [code]0.0[/code] to be considered valid.

func (Instance) HasDefaultFont

func (self Instance) HasDefaultFont() bool

Returns [code]true[/code] if [member default_font] has a valid value. Returns [code]false[/code] if it doesn't.

func (Instance) HasDefaultFontSize

func (self Instance) HasDefaultFontSize() bool

Returns [code]true[/code] if [member default_font_size] has a valid value. Returns [code]false[/code] if it doesn't. The value must be greater than [code]0[/code] to be considered valid.

func (Instance) HasFont

func (self Instance) HasFont(name string, theme_type string) bool

Returns [code]true[/code] if the [Font] property defined by [param name] and [param theme_type] exists, or if the default theme font is set up (see [method has_default_font]). Returns [code]false[/code] if neither exist. Use [method set_font] to define the property.

func (Instance) HasFontSize

func (self Instance) HasFontSize(name string, theme_type string) bool

Returns [code]true[/code] if the font size property defined by [param name] and [param theme_type] exists, or if the default theme font size is set up (see [method has_default_font_size]). Returns [code]false[/code] if neither exist. Use [method set_font_size] to define the property.

func (Instance) HasIcon

func (self Instance) HasIcon(name string, theme_type string) bool

Returns [code]true[/code] if the icon property defined by [param name] and [param theme_type] exists. Returns [code]false[/code] if it doesn't exist. Use [method set_icon] to define it.

func (Instance) HasStylebox

func (self Instance) HasStylebox(name string, theme_type string) bool

Returns [code]true[/code] if the [StyleBox] property defined by [param name] and [param theme_type] exists. Returns [code]false[/code] if it doesn't exist. Use [method set_stylebox] to define it.

func (Instance) HasThemeItem

func (self Instance) HasThemeItem(data_type gdclass.ThemeDataType, name string, theme_type string) bool

Returns [code]true[/code] if the theme property of [param data_type] defined by [param name] and [param theme_type] exists. Returns [code]false[/code] if it doesn't exist. Use [method set_theme_item] to define it. [b]Note:[/b] This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.

func (Instance) IsTypeVariation

func (self Instance) IsTypeVariation(theme_type string, base_type string) bool

Returns [code]true[/code] if [param theme_type] is marked as a variation of [param base_type].

func (Instance) MergeWith

func (self Instance) MergeWith(other [1]gdclass.Theme)

Adds missing and overrides existing definitions with values from the [param other] theme resource. [b]Note:[/b] 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

func (self Instance) RemoveType(theme_type string)

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

func (self Instance) RenameColor(old_name string, name string, theme_type string)

Renames the [Color] property defined by [param old_name] and [param theme_type] to [param name], if it exists. Fails if it doesn't exist, or if a similar property with the new name already exists. Use [method has_color] to check for existence, and [method clear_color] to remove the existing property.

func (Instance) RenameConstant

func (self Instance) RenameConstant(old_name string, name string, theme_type string)

Renames the constant property defined by [param old_name] and [param theme_type] to [param name], if it exists. Fails if it doesn't exist, or if a similar property with the new name already exists. Use [method has_constant] to check for existence, and [method clear_constant] to remove the existing property.

func (Instance) RenameFont

func (self Instance) RenameFont(old_name string, name string, theme_type string)

Renames the [Font] property defined by [param old_name] and [param theme_type] to [param name], if it exists. Fails if it doesn't exist, or if a similar property with the new name already exists. Use [method has_font] to check for existence, and [method clear_font] to remove the existing property.

func (Instance) RenameFontSize

func (self Instance) RenameFontSize(old_name string, name string, theme_type string)

Renames the font size property defined by [param old_name] and [param theme_type] to [param name], if it exists. Fails if it doesn't exist, or if a similar property with the new name already exists. Use [method has_font_size] to check for existence, and [method clear_font_size] to remove the existing property.

func (Instance) RenameIcon

func (self Instance) RenameIcon(old_name string, name string, theme_type string)

Renames the icon property defined by [param old_name] and [param theme_type] to [param name], if it exists. Fails if it doesn't exist, or if a similar property with the new name already exists. Use [method has_icon] to check for existence, and [method clear_icon] to remove the existing property.

func (Instance) RenameStylebox

func (self Instance) RenameStylebox(old_name string, name string, theme_type string)

Renames the [StyleBox] property defined by [param old_name] and [param theme_type] to [param name], if it exists. Fails if it doesn't exist, or if a similar property with the new name already exists. Use [method has_stylebox] to check for existence, and [method clear_stylebox] to remove the existing property.

func (Instance) RenameThemeItem

func (self Instance) RenameThemeItem(data_type gdclass.ThemeDataType, old_name string, name string, theme_type string)

Renames the theme property of [param data_type] defined by [param old_name] and [param theme_type] to [param name], if it exists. Fails if it doesn't exist, or if a similar property with the new name already exists. Use [method has_theme_item] to check for existence, and [method clear_theme_item] to remove the existing property. [b]Note:[/b] This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.

func (Instance) SetColor

func (self Instance) SetColor(name string, theme_type string, color Color.RGBA)

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

func (Instance) SetConstant

func (self Instance) SetConstant(name string, theme_type string, constant int)

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

func (Instance) SetDefaultBaseScale

func (self Instance) SetDefaultBaseScale(value Float.X)

func (Instance) SetDefaultFont

func (self Instance) SetDefaultFont(value [1]gdclass.Font)

func (Instance) SetDefaultFontSize

func (self Instance) SetDefaultFontSize(value int)

func (Instance) SetFont

func (self Instance) SetFont(name string, theme_type string, font [1]gdclass.Font)

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

func (Instance) SetFontSize

func (self Instance) SetFontSize(name string, theme_type string, font_size int)

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

func (Instance) SetIcon

func (self Instance) SetIcon(name string, theme_type string, texture [1]gdclass.Texture2D)

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

func (Instance) SetStylebox

func (self Instance) SetStylebox(name string, theme_type string, texture [1]gdclass.StyleBox)

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

func (Instance) SetThemeItem

func (self Instance) SetThemeItem(data_type gdclass.ThemeDataType, name string, theme_type string, value any)

Creates or changes the value of the theme property of [param data_type] defined by [param name] and [param theme_type]. Use [method clear_theme_item] to remove the property. Fails if the [param value] type is not accepted by [param data_type]. [b]Note:[/b] This method is analogous to calling the corresponding data type specific method, but can be used for more generalized logic.

func (Instance) SetTypeVariation

func (self Instance) SetTypeVariation(theme_type string, base_type string)

Marks [param theme_type] as a variation of [param base_type]. This adds [param theme_type] as a suggested option for [member Control.theme_type_variation] on a [Control] that is of the [param base_type] class. Variations can also be nested, i.e. [param base_type] can be another variation. If a chain of variations ends with a [param base_type] matching the class of the [Control], the whole chain is going to be suggested as options. [b]Note:[/b] Suggestions only show up if this theme resource is set as the project default theme. See [member ProjectSettings.gui/theme/custom].

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL