Class Theme
Responsible for switching and applying color changes using the referenced ColorScheme's. Two ColorScheme's necessary: One for light mode, and one for dark mode.
Inheritance
Namespace: AdrianMiasik.ScriptableObjects
Assembly: Assembly-CSharp.dll
Syntax
[CreateAssetMenu(fileName = "New Theme", menuName = "Adrian Miasik/Create New Theme")]
public class Theme : ScriptableObject
Fields
| Improve this Doc View Sourcem_dark
Declaration
public ColorScheme m_dark
Field Value
Type | Description |
---|---|
ColorScheme |
m_light
Declaration
public ColorScheme m_light
Field Value
Type | Description |
---|---|
ColorScheme |
Methods
| Improve this Doc View SourceApplyColorChanges()
Updates (and invokes ColorUpdate to) all our registered (IColorHook) color elements.
Declaration
public void ApplyColorChanges()
Deregister(IColorHook)
Disassociates the provided (IColorHook) color element from this theme (If they exist).
Declaration
public void Deregister(IColorHook colorHook)
Parameters
Type | Name | Description |
---|---|---|
IColorHook | colorHook | The color element you want to deregister/disassociate with this theme. |
DeregisterAllElements()
Disassociates all our color hook elements from this Theme.
Declaration
public void DeregisterAllElements()
GetCurrentColorScheme()
Fetches the appropriate ColorScheme depending on the user's preference. Depending if they prefer light / dark mode.
Declaration
public ColorScheme GetCurrentColorScheme()
Returns
Type | Description |
---|---|
ColorScheme | The user's preferred ColorScheme |
IsDarkMode()
Declaration
public bool IsDarkMode()
Returns
Type | Description |
---|---|
System.Boolean |
ListInterfaces()
Displays into the console all the color elements (IColorHook) gameobjects that have been registered to this theme.
Declaration
[ContextMenu("List Interfaces")]
public void ListInterfaces()
Register(IColorHook)
Associates the provided (IColorHook) color element to this theme. This is used for updating our elements when we are validating editor colors, or switching between different ColorScheme's. See SetToDarkMode(Boolean) and SetToLightMode(Boolean).
Declaration
public void Register(IColorHook hook)
Parameters
Type | Name | Description |
---|---|---|
IColorHook | hook | The color element you want to register/associate with this theme. |
Register(IColorHook, PomodoroTimer)
Initialization
Declaration
public void Register(IColorHook hook, PomodoroTimer pomodoroTimer)
Parameters
Type | Name | Description |
---|---|---|
IColorHook | hook | |
PomodoroTimer | pomodoroTimer |
SetToDarkMode(Boolean)
Set's the current ColorScheme to the dark variation and updates all registered elements.
Declaration
public void SetToDarkMode(bool save = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | save |
SetToLightMode(Boolean)
Set's the current ColorScheme to the light variation and updates all registered elements.
Declaration
public void SetToLightMode(bool save = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | save |
TransferColorElements(Theme, Theme)
Transfers all our (IColorHook) color elements from one theme to another. Including theme related settings.
Declaration
public void TransferColorElements(Theme sourceTheme, Theme destinationTheme)
Parameters
Type | Name | Description |
---|---|---|
Theme | sourceTheme | The theme you want to pull color elements from. |
Theme | destinationTheme | The theme you want to transfer your color elements to. |