Show / Hide Table of Contents

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
System.Object
UnityEngine.Object
UnityEngine.ScriptableObject
Theme
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 Source

m_dark

Declaration
public ColorScheme m_dark
Field Value
Type Description
ColorScheme
| Improve this Doc View Source

m_light

Declaration
public ColorScheme m_light
Field Value
Type Description
ColorScheme

Methods

| Improve this Doc View Source

ApplyColorChanges()

Updates (and invokes ColorUpdate to) all our registered (IColorHook) color elements.

Declaration
public void ApplyColorChanges()
| Improve this Doc View Source

Deregister(IColorHook)

Disassociates the provided (IColorHook) color element from this theme (If they exist). This is usually invoked before gameobject deletion or if you no longer want to update color elements between ColorScheme's changes.

Declaration
public void Deregister(IColorHook colorHook)
Parameters
Type Name Description
IColorHook colorHook

The color element you want to deregister/disassociate with this theme.

| Improve this Doc View Source

DeregisterAllElements()

Disassociates all our color hook elements from this Theme.

Declaration
public void DeregisterAllElements()
| Improve this Doc View Source

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

| Improve this Doc View Source

IsDarkMode()

Declaration
public bool IsDarkMode()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

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()
| Improve this Doc View Source

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.

| Improve this Doc View Source

Register(IColorHook, PomodoroTimer)

Initialization

Declaration
public void Register(IColorHook hook, PomodoroTimer pomodoroTimer)
Parameters
Type Name Description
IColorHook hook
PomodoroTimer pomodoroTimer
| Improve this Doc View Source

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
| Improve this Doc View Source

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
| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX