Semantic Color Palette
A semantic color management system for Unity: organize your colors in meaningful palettes and assign them to all kind of "colorable" components. No more updating color values in multiple places!
This package provides a semantic color management system for Unity.
So, what is semantic color management?
Basically, you define a set of meaningful identifiers for colors, representing where/how each color is used (e.g. "buttonBackground"), and not the colors themselves (e.g. "darkBrown").
Then, elsewhere, you map each idenfier to an actual color value.
The elements where colors are to be applied never directly refer to actual, specific colors, but only to semantic color ids.
This decoupling allows to quickly and flawlessly change colors to multiple elements in a centralized way, and to easily implement some form of "color skinning" by applying different id -> color mappings.
How does this system work in practice?
There are three core elements that work together to achieve its design goals:
- Palette: a named set of id -> color mappings. It is a "data" element, usually persistent.
- Palette provider: an active element, living in a Unity scene, that acts as a broker between palettes and colorers, pushing color updates to any relevant colorers.
- Colorer: an active element that contains the logic to apply one or more colors to a scene component (UI elements, 3D models materials and more). A colorer must be connected to a palette provider, from which it retrieves colors for the color identifiers specified in its configuration.
Ready to use Colorers for Unity components using color properties (UI elements, Materials etc) are included. That said, programmers can easily extend the system with additional custom colorers (and providers).
You can improve your workflow with a new, more reasonable way to setup colors in Unity, with low friction and no compromises on your project organization.
Anything can be done through the inspector if you want, but it's also easy to use the system through code only if you prefer.
Palettes can be imported from commonly used third party formats and edited in the inspector, and in more advanced scenarios can be loaded at runtime from external files.
The asset contents are laid out to be easily packaged for use in the Package Manager, if you want to easily import it (maybe including your own customizations) from multiple projects.
Technical details
This asset installs as a set of packages you can handle with the Unity Package Manager.
Warning: if you are updating from a previous version, you must delete the previous version from `Assets\BinaryCharm` and `Gizmos\BinaryCharm` before importing!
- Quick setup thanks to inspector customizations.
- Works both in editor and at runtime.
- Ready-to-use components to apply semantic palette colors to all kinds of Unity components
- UI (Button, Dropdown, Image, InputField, RawImage, Scrollbar, Selectable, Slider, Text, Toggle)
- TextMeshPro (Button, TMP_Dropdown, TMP_InputField, TMP_Text)
- Renderers (LineRenderer, SpriteRenderer, TrailRenderer)
- Globals (Fog, Skybox)
- Materials (Renderer, Font, Graphic)
- Others (Light, TextMesh)
- Scalable: handles any number of palette and palette variants, allowing to reuse them in different projects by simply copying their files.
- Extensible: can handle transparently new ways to provide and apply colors, implementing custom "palette providers" and "colorers".
- Imports/Exports palettes to JSON (even at runtime/in builds)
- Imports palettes from popular third party formats (even at runtime/in builds):
- SVG
- ACO, ASE (Adobe Photoshop)
- GPL (Gimp)
- KPL (Krita)
- XML (Android "colors.xml" format)
- Color space conversion utilities
- Clean, simple API for (optional) code based usage
- Runtime Manager UI ready to be embedded in your projects
- allowing artists not using Unity to adjust colors and export the modified palettes
- Installs in `Packages`, withouth cluttering your `Assets` folder
- Full source code included:
- Core system
- Runtime Manager UI
- third party content (MIT license): UnitySimpleFileBrowser, HSVPicker
- Sample project
- third party content: demo assets from Unity Tanks! demo
- also contains useful, ready to use sample extensions: FadingPaletteProvider, Shade/Tint colorers