-
Notifications
You must be signed in to change notification settings - Fork 0
Theme
Home | API by Category | Complete API Index | API Compatibility
| Field | Value |
|---|---|
| Full name | Electron2D.Theme |
| Namespace | Electron2D |
| Kind | class |
| Category | UI and Text |
Provides a reusable resource for styling UI controls.
public class Electron2D.Theme : Electron2D.ResourceProfile: Electron2D 0.1.0 2D
Status: Supported / Parity verified
Out of profile: no
Godot reference: Theme
UI theme resource with colors, constants, fonts, font sizes, icons, style boxes, defaults, AOT-safe value serialization and branch lookup through Control.
Theme stores typed UI items by item name and theme type. Controls
resolve local overrides first, then the nearest theme assigned to a control
branch.
This type is not synchronized. Create and mutate themes on the main scene thread.
This type is available since Electron2D 0.1.0 Preview.
Electron2D.Control.ThemeElectron2D.StyleBox
| Member | Kind | Summary |
|---|---|---|
DefaultBaseScale |
Property | Gets or sets the default base scale for this theme. |
DefaultFont |
Property | Gets or sets the default font for this theme. |
DefaultFontSize |
Property | Gets or sets the default font size for this theme. |
Electron2D.Theme() |
Constructor | Initializes a new instance of the Electron2D.Theme class. |
Clear() |
Method | Removes all items and default values from this theme. |
ClearColor(System.String, System.String) |
Method | Removes a color item. |
ClearConstant(System.String, System.String) |
Method | Removes a constant item. |
ClearFont(System.String, System.String) |
Method | Removes a font item. |
ClearFontSize(System.String, System.String) |
Method | Removes a font size item. |
ClearIcon(System.String, System.String) |
Method | Removes an icon item. |
ClearStyleBox(System.String, System.String) |
Method | Removes a style box item. |
GetColor(System.String, System.String) |
Method | Gets a color item. |
GetConstant(System.String, System.String) |
Method | Gets a constant item. |
GetFont(System.String, System.String) |
Method | Gets a font item. |
GetFontSize(System.String, System.String) |
Method | Gets a font size item. |
GetIcon(System.String, System.String) |
Method | Gets an icon item. |
GetStyleBox(System.String, System.String) |
Method | Gets a style box item. |
HasColor(System.String, System.String) |
Method | Reports whether a color item exists. |
HasConstant(System.String, System.String) |
Method | Reports whether a constant item exists. |
HasDefaultBaseScale() |
Method | Reports whether this theme has a valid default base scale. |
HasDefaultFont() |
Method | Reports whether this theme has a default font. |
HasDefaultFontSize() |
Method | Reports whether this theme has a valid default font size. |
HasFont(System.String, System.String) |
Method | Reports whether a font item exists. |
HasFontSize(System.String, System.String) |
Method | Reports whether a font size item exists. |
HasIcon(System.String, System.String) |
Method | Reports whether an icon item exists. |
HasStyleBox(System.String, System.String) |
Method | Reports whether a style box item exists. |
SetColor(System.String, System.String, Electron2D.Color) |
Method | Sets a color item. |
SetConstant(System.String, System.String, System.Int32) |
Method | Sets a constant item. |
SetFont(System.String, System.String, Electron2D.Font) |
Method | Sets a font item. |
SetFontSize(System.String, System.String, System.Int32) |
Method | Sets a font size item. |
SetIcon(System.String, System.String, Electron2D.Texture2D) |
Method | Sets an icon item. |
SetStyleBox(System.String, System.String, Electron2D.StyleBox) |
Method | Sets a style box item. |
Kind: Property
public System.Single DefaultBaseScale { get; set; }Gets or sets the default base scale for this theme.
Controls use this value to scale resolved constants and font sizes.
A finite non-negative scale. A value of 0 means the theme has no
explicit base scale.
-
System.ArgumentOutOfRangeException: Thrown when the assigned value is negative or not finite.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.HasDefaultBaseScale
Kind: Property
public Electron2D.Font DefaultFont { get; set; }Gets or sets the default font for this theme.
Controls use this value when a requested font item is not present.
The fallback font resource, or null when no default font is set.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.HasDefaultFont
Kind: Property
public System.Int32 DefaultFontSize { get; set; }Gets or sets the default font size for this theme.
Controls scale this value by the resolved theme base scale before using it for drawing.
The fallback font size in UI units. Values below 1 mean no
default font size is set.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.HasDefaultFontSize
Kind: Constructor
public Electron2D.Theme()Initializes a new instance of the Electron2D.Theme class.
The new theme contains no items and uses runtime fallback values for missing theme lookups.
This constructor is not synchronized. Call it from the main scene thread.
This constructor is available since Electron2D 0.1.0 Preview.
Electron2D.Theme
Kind: Method
public System.Void Clear()()Removes all items and default values from this theme.
The theme remains usable after clearing. Later lookups fall back to runtime defaults until new items are added.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.SetColor(System.String,System.String,Electron2D.Color)
Kind: Method
public System.Void ClearColor(System.String, System.String)(System.String name, System.String themeType)Removes a color item.
Removing a missing item is a no-op.
-
name: The color item name. -
themeType: The theme type that owns the item.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.HasColor(System.String,System.String)
Kind: Method
public System.Void ClearConstant(System.String, System.String)(System.String name, System.String themeType)Removes a constant item.
Removing a missing item is a no-op.
-
name: The constant item name. -
themeType: The theme type that owns the item.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.HasConstant(System.String,System.String)
Kind: Method
public System.Void ClearFont(System.String, System.String)(System.String name, System.String themeType)Removes a font item.
Removing a missing item is a no-op.
-
name: The font item name. -
themeType: The theme type that owns the item.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.HasFont(System.String,System.String)
Kind: Method
public System.Void ClearFontSize(System.String, System.String)(System.String name, System.String themeType)Removes a font size item.
Removing a missing item is a no-op.
-
name: The font size item name. -
themeType: The theme type that owns the item.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.HasFontSize(System.String,System.String)
Kind: Method
public System.Void ClearIcon(System.String, System.String)(System.String name, System.String themeType)Removes an icon item.
Removing a missing item is a no-op.
-
name: The icon item name. -
themeType: The theme type that owns the item.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.HasIcon(System.String,System.String)
Kind: Method
public System.Void ClearStyleBox(System.String, System.String)(System.String name, System.String themeType)Removes a style box item.
Removing a missing item is a no-op.
-
name: The style box item name. -
themeType: The theme type that owns the item.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.HasStyleBox(System.String,System.String)
Kind: Method
public Electron2D.Color GetColor(System.String, System.String)(System.String name, System.String themeType)Gets a color item.
Use Electron2D.Theme.HasColor(System.String,System.String) to distinguish an explicit
white color from a missing item.
-
name: The color item name. -
themeType: The theme type that owns the item.
The stored color, or opaque white when the item is missing.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.SetColor(System.String,System.String,Electron2D.Color)
Kind: Method
public System.Int32 GetConstant(System.String, System.String)(System.String name, System.String themeType)Gets a constant item.
Use Electron2D.Theme.HasConstant(System.String,System.String) to distinguish an explicit
zero from a missing item.
-
name: The constant item name. -
themeType: The theme type that owns the item.
The stored constant, or 0 when the item is missing.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.SetConstant(System.String,System.String,System.Int32)
Kind: Method
public Electron2D.Font GetFont(System.String, System.String)(System.String name, System.String themeType)Gets a font item.
Use Electron2D.Theme.HasFont(System.String,System.String) to distinguish a named item
from the default font fallback.
-
name: The font item name. -
themeType: The theme type that owns the item.
The stored font, the default font, or null when neither exists.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.SetFont(System.String,System.String,Electron2D.Font)
Kind: Method
public System.Int32 GetFontSize(System.String, System.String)(System.String name, System.String themeType)Gets a font size item.
This method returns the raw theme value. Controls apply base scale when resolving font size items.
-
name: The font size item name. -
themeType: The theme type that owns the item.
The stored font size, the default font size, or 16 when neither
exists.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.SetFontSize(System.String,System.String,System.Int32)
Kind: Method
public Electron2D.Texture2D GetIcon(System.String, System.String)(System.String name, System.String themeType)Gets an icon item.
Icon items are runtime texture resources resolved by controls and custom widgets.
-
name: The icon item name. -
themeType: The theme type that owns the item.
The stored icon, or null when the item is missing.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.SetIcon(System.String,System.String,Electron2D.Texture2D)
Kind: Method
public Electron2D.StyleBox GetStyleBox(System.String, System.String)(System.String name, System.String themeType)Gets a style box item.
Style boxes are used by controls to draw themed backgrounds and borders.
-
name: The style box item name. -
themeType: The theme type that owns the item.
The stored style box, or null when the item is missing.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.SetStyleBox(System.String,System.String,Electron2D.StyleBox)
Kind: Method
public System.Boolean HasColor(System.String, System.String)(System.String name, System.String themeType)Reports whether a color item exists.
This method checks only color items and does not inspect defaults.
-
name: The color item name. -
themeType: The theme type that owns the item.
true when the item exists; otherwise, false.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.SetColor(System.String,System.String,Electron2D.Color)
Kind: Method
public System.Boolean HasConstant(System.String, System.String)(System.String name, System.String themeType)Reports whether a constant item exists.
This method checks only constant items and does not inspect defaults.
-
name: The constant item name. -
themeType: The theme type that owns the item.
true when the item exists; otherwise, false.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.SetConstant(System.String,System.String,System.Int32)
Kind: Method
public System.Boolean HasDefaultBaseScale()()Reports whether this theme has a valid default base scale.
A theme without a base scale falls back to the runtime scale
1.
true when Electron2D.Theme.DefaultBaseScale is greater than
0; otherwise, false.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.DefaultBaseScale
Kind: Method
public System.Boolean HasDefaultFont()()Reports whether this theme has a default font.
A default font is used only when a specific font item is missing.
true when Electron2D.Theme.DefaultFont is not null;
otherwise, false.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.DefaultFont
Kind: Method
public System.Boolean HasDefaultFontSize()()Reports whether this theme has a valid default font size.
A default font size is used only when a specific font size item is missing.
true when Electron2D.Theme.DefaultFontSize is greater than
0; otherwise, false.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.DefaultFontSize
Kind: Method
public System.Boolean HasFont(System.String, System.String)(System.String name, System.String themeType)Reports whether a font item exists.
This method checks only named font items and does not inspect
Electron2D.Theme.DefaultFont.
-
name: The font item name. -
themeType: The theme type that owns the item.
true when the item exists; otherwise, false.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.SetFont(System.String,System.String,Electron2D.Font)
Kind: Method
public System.Boolean HasFontSize(System.String, System.String)(System.String name, System.String themeType)Reports whether a font size item exists.
This method checks only named font size items and does not inspect
Electron2D.Theme.DefaultFontSize.
-
name: The font size item name. -
themeType: The theme type that owns the item.
true when the item exists; otherwise, false.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.SetFontSize(System.String,System.String,System.Int32)
Kind: Method
public System.Boolean HasIcon(System.String, System.String)(System.String name, System.String themeType)Reports whether an icon item exists.
This method checks only icon items.
-
name: The icon item name. -
themeType: The theme type that owns the item.
true when the item exists; otherwise, false.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.SetIcon(System.String,System.String,Electron2D.Texture2D)
Kind: Method
public System.Boolean HasStyleBox(System.String, System.String)(System.String name, System.String themeType)Reports whether a style box item exists.
This method checks only style box items.
-
name: The style box item name. -
themeType: The theme type that owns the item.
true when the item exists; otherwise, false.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.SetStyleBox(System.String,System.String,Electron2D.StyleBox)
Kind: Method
public System.Void SetColor(System.String, System.String, Electron2D.Color)(System.String name, System.String themeType, Electron2D.Color color)Sets a color item.
Existing items with the same name and theme type are replaced.
-
name: The color item name. -
themeType: The theme type that owns the item. -
color: The color value to store.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.GetColor(System.String,System.String)
Kind: Method
public System.Void SetConstant(System.String, System.String, System.Int32)(System.String name, System.String themeType, System.Int32 constant)Sets a constant item.
Constants are scaled by controls when resolved through
Electron2D.Control.GetThemeConstant(System.String,System.String).
-
name: The constant item name. -
themeType: The theme type that owns the item. -
constant: The non-negative integer value to store.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty. -
System.ArgumentOutOfRangeException: Thrown whenconstantis negative.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.GetConstant(System.String,System.String)
Kind: Method
public System.Void SetFont(System.String, System.String, Electron2D.Font)(System.String name, System.String themeType, Electron2D.Font font)Sets a font item.
Existing items with the same name and theme type are replaced.
-
name: The font item name. -
themeType: The theme type that owns the item. -
font: The font resource to store.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty. -
System.ArgumentNullException: Thrown whenfontisnull.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.GetFont(System.String,System.String)
Kind: Method
public System.Void SetFontSize(System.String, System.String, System.Int32)(System.String name, System.String themeType, System.Int32 fontSize)Sets a font size item.
Font sizes are scaled by controls when resolved through
Electron2D.Control.GetThemeFontSize(System.String,System.String).
-
name: The font size item name. -
themeType: The theme type that owns the item. -
fontSize: The font size value. It must be greater than zero.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty. -
System.ArgumentOutOfRangeException: Thrown whenfontSizeis less than or equal to zero.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.GetFontSize(System.String,System.String)
Kind: Method
public System.Void SetIcon(System.String, System.String, Electron2D.Texture2D)(System.String name, System.String themeType, Electron2D.Texture2D icon)Sets an icon item.
Existing items with the same name and theme type are replaced.
-
name: The icon item name. -
themeType: The theme type that owns the item. -
icon: The texture resource to store.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty. -
System.ArgumentNullException: Thrown wheniconisnull.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.GetIcon(System.String,System.String)
Kind: Method
public System.Void SetStyleBox(System.String, System.String, Electron2D.StyleBox)(System.String name, System.String themeType, Electron2D.StyleBox styleBox)Sets a style box item.
Existing items with the same name and theme type are replaced.
-
name: The style box item name. -
themeType: The theme type that owns the item. -
styleBox: The style box resource to store.
-
System.ArgumentException: Thrown whennameorthemeTypeis empty. -
System.ArgumentNullException: Thrown whenstyleBoxisnull.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Theme.GetStyleBox(System.String,System.String)
Electron2D 0.1.0 Preview API reference. Generated from 175 public runtime types.