Class Theme
- Namespace
- UILib
- Assembly
- UILib.dll
Provides a way of modifying how UIs are themed.
public class Theme : ICloneable
- Inheritance
-
Theme
- Implements
- Inherited Members
Constructors
Theme(string)
Constructs an instance of the fallback theme with a custom name.
Use this if you want to create a new theme to register with UILib.
public Theme(string name)
Parameters
namestringThe name to use
Fields
accent
The accent color (such as the backgrounds of the scroll bars for ScrollViews and the title bar for Windows.
public Color accent
Field Value
- Color
accentAlt
The alternate accent color (such as the background of the color picker window.
public Color accentAlt
Field Value
- Color
background
The background color (such as the background for Windows).
public Color background
Field Value
- Color
font
The default font to be used.
public Font font
Field Value
- Font
fontAlt
The secondary font to be used.
This exists specifically to deal with
TextFields
as the underlying Unity InputFields
can process some fonts incorrectly.
public Font fontAlt
Field Value
- Font
fontLineSpacing
The line spacing to use on this font.
public float fontLineSpacing
Field Value
fontScaler
The value to scale fonts by.
This could be useful if you have already made a large UI and want to swap out the font, and the font sizes you originally chose are too small/large with the new font.
Here you can just scale the font by a value instead of going through every place you specified a font size.
public float fontScaler
Field Value
fontScalerAlt
Like fontScaler but specific to TextFields due to the reasons explained in fontAlt.
public float fontScalerAlt
Field Value
foreground
The foreground color (like on text).
public Color foreground
Field Value
- Color
importantHighlight
The secondary important color. This is used as the highlighted background of the close button on Windows.
public Color importantHighlight
Field Value
- Color
importantNormal
The primary important color. This is used as the initial background of the close button on Windows.
public Color importantNormal
Field Value
- Color
inputOverlayFadeTime
How long it should take for the UILib.InputOverlay to fade in/out. This applies whenever the overlay is shown/hidden.
public float inputOverlayFadeTime
Field Value
inputOverlayOpacity
The default/maximum opacity to apply to the UILib.InputOverlay. This will only affect the background of the overlay, not all content on it. Must be between 0-1 inclusive.
public float inputOverlayOpacity
Field Value
navigationSound
The sound to play in place of the game's built-in click sound.
public AudioClip navigationSound
Field Value
- AudioClip
navigationSoundVolume
The volume to play the navigation sound with.
public float navigationSoundVolume
Field Value
notification
The default notification sound to use.
public AudioClip notification
Field Value
- AudioClip
notificationError
The error notification sound to use.
public AudioClip notificationError
Field Value
- AudioClip
notificationErrorVolume
The volume to play the error notification with.
public float notificationErrorVolume
Field Value
notificationFadeTime
How long it should take for a notification to fade out.
public float notificationFadeTime
Field Value
notificationMaxMessage
The maximum length of a notification's message before it starts getting replaced with ellipses.
public int notificationMaxMessage
Field Value
notificationMaxTitle
The maximum length of a notification's title before it starts getting replaced with ellipses.
public int notificationMaxTitle
Field Value
notificationOpacity
The opacity to apply to notifications.
public float notificationOpacity
Field Value
notificationVolume
The volume to play the default notification with.
public float notificationVolume
Field Value
notificationWaitTime
How long the notification should stay on screen before fading. Note that error notifications ignore this and will always stay on the screen until dismissed by the user.
public float notificationWaitTime
Field Value
overlayFadeTime
How long it should take for Overlays to fade in/out. This applies whenever an overlay is shown/hidden.
public float overlayFadeTime
Field Value
overlayOpacity
The default/maximum opacity to apply to
Overlays.
Must be between 0-1 inclusive.
Note this affects all content on the overlay as well,
since this just uses a CanvasGroup applied to the overlay.
public float overlayOpacity
Field Value
selectAltHighlight
A secondary highlight color for selectables. This will be the highlight color of the handles for Sliders..
public Color selectAltHighlight
Field Value
- Color
selectAltNormal
A secondary normal color for selectables. This will be the normal color of the handles for Sliders and the highlight color of scroll bars of ScrollViews.
public Color selectAltNormal
Field Value
- Color
selectFadeTime
How long it should take a selectable to fade between its normal and highlight colors.
public float selectFadeTime
Field Value
selectHighlight
The highlighted color for selectables (such as the background of Buttons when hovered over).
public Color selectHighlight
Field Value
- Color
selectNormal
The normal color for selectables (such as the background of Buttons).
public Color selectNormal
Field Value
- Color
windowDecorationFadeTime
How long it should take for the Window's decorations to fade in/out. This applies whenever Enable() or Disable() is called.
public float windowDecorationFadeTime
Field Value
windowDecorationOpacity
The default opacity to set on a Window's decoratons (title bar, scroll bar, etc.) Must be between 0-1 inclusive.
public float windowDecorationOpacity
Field Value
windowOpacity
The default opacity to set on a Window's background. Must be between 0-1 inclusive.
public float windowOpacity
Field Value
Properties
name
The name of this theme.
public string name { get; }
Property Value
Methods
Clone()
Supports making a clone of this theme. You probably want to use Copy() instead though, since it also handles converting to a Theme.
public object Clone()
Returns
- object
The clone
Copy()
public Theme Copy()
Returns
- Theme
The copy
Copy(string)
Takes a copy of this theme and applies a custom name.
public Theme Copy(string name)
Parameters
namestring
Returns
- Theme
The copy with a custom name
GetTheme()
Gets a copy of the current theme.
You can only rely on this being usable from onPreInit onwards.
public static Theme GetTheme()
Returns
- Theme
A copy of the current theme
GetTheme(string)
Gets a registered theme.
You can only rely on this being usable from onPreInit onwards.
public static Theme GetTheme(string name)
Parameters
namestring
Returns
- Theme
The theme if found, null otherwise
GetThemes()
Gets all registered themes.
You can only rely on this being usable from onPreInit onwards.
Note: These themes are not copies.
public static Dictionary<string, Theme> GetThemes()
Returns
- Dictionary<string, Theme>
The registered themes
Register(Theme)
Registers a new theme.
If you wish to register a new theme, its name must be unique.
You should register themes in Awake.
You shouldn't use event listeners for
onPreInit or onInit
just register directly in Awake.
public static void Register(Theme theme)
Parameters
themeThemeThe theme to add