2.0.2 • Published 8 months ago
extensions.unity.theme v2.0.2
Unity-Theme
Create palettes of colors and components to change specific colors on a specific visual element. Very useful for UI.
Features
- ✔️ Name colors
- ✔️ Create custom themes with names
- ✔️ Add as many colors as you need
- ✔️ Name a theme as you want
- ✔️ Change theme any moment by name
- ✔️ Bind color to:
Image
,SpriteRenderer
,TextMeshPro
, etc - ✔️ Easy way to add custom color binder by new C# class with just a few lines of code
- ✔️ Rename color even after binding to a component, with no broken links
Installation
- Install OpenUPM-CLI
- Open command line in Unity project folder
openupm add extensions.unity.theme
Usage
- Go to
Window/Unity-Theme
- Customize color palettes as you want
- Add
ColorBinder
components to a target GameObject
Color Binder
A component that binds a color to a specific target, such as Image
, SpriteRenderer
, TextMeshPro
, or anything else.
There is a list of built-in color binders:
ImageColorBinder
SpriteRendererColorBinder
TextMeshProColorBinder
Color palettes
Modify palettes, instant response with all connected GameObjects.
C# Api
Colors
using Unity.Theme;
Theme.Instance.AddColor("Primary", "#6750A4");
Theme.Instance.AddColor("Primary", Color.white);
Theme.Instance.SetColor("Primary", "#6750A4");
Theme.Instance.SetColor("Primary", Color.white);
Theme.Instance.SetOrAddColor("Primary", "#6750A4");
Theme.Instance.SetOrAddColor("Primary", Color.white);
Theme.Instance.RemoveColorByName("Primary");
Theme.Instance.RemoveColor(colorData);
Theme.Instance.RemoveAllColors();
Themes
using Unity.Theme;
Theme.Instance.AddTheme("Light");
Theme.Instance.SetOrAddTheme("Light");
Theme.Instance.CurrentThemeName = "Light";
Theme.Instance.CurrentThemeIndex = 0;
Theme.Instance.RemoveTheme("Light");
Theme.Instance.RemoveAllThemes();
Create a custom ColorBinder
If you need to bind color to something else, you may extend from BaseColorBinder
as listed below.
using UnityEngine;
using TMPro;
namespace Unity.Theme.Binders
{
[AddComponentMenu("Theme/TextMeshPro Color Binder")]
public class TextMeshProColorBinder : BaseColorBinder
{
[SerializeField] TextMeshProUGUI textMeshPro;
protected override void Awake()
{
if (textMeshPro == null) textMeshPro = GetComponent<TextMeshProUGUI>();
base.Awake();
}
protected override void SetColor(Color color)
{
textMeshPro.color = color;
}
}
}
Other
- Color palette builder by Google's Material Design V3
2.0.2
8 months ago
1.0.1
9 months ago
2.0.1
8 months ago
2.0.0
9 months ago
1.0.0
1 year ago
0.1.15
1 year ago
0.1.10
2 years ago
0.1.11
2 years ago
0.1.12
2 years ago
0.1.13
2 years ago
0.1.14
2 years ago
0.1.8
2 years ago
0.1.7
2 years ago
0.1.9
2 years ago
0.1.4
2 years ago
0.1.3
2 years ago
0.1.6
2 years ago
0.1.5
2 years ago
0.1.2
2 years ago
0.1.0
2 years ago
0.0.3
2 years ago
0.1.1
2 years ago
0.0.2
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.6
2 years ago
0.0.1
2 years ago