Working with Selectable
Many widgets are inherited from the
Selectable component which is used to control widgets’ appearance depending on state.
In most cases used
Color Tint transition.
But it has some nuances on how it works:
- result color =
TargetGraphic.Sprite (if has any) *
TargetGraphic.color * (
- colors actually represented in the range 0-1 (in editor range 0-255 is used because it is human readable)
- white is 1, black is 0
Those things matter when you try to create a dark theme:
multiplying black color (
TargetGraphic.color) on any tint color gives the same black color so you do not see any visual differences between states.
There are a few possible solutions for this:
- increase the
ColorMultiplier value and do not use completely black colors, but it will be difficult to get the desired colors
TargetGraphic.Color to white and use
normalColor to make it black by default (this does not help if
TargetGraphic.Sprite is black)
- use the
Sprite Swap transition (no color multiplication no problem with black), but in this case, you need the sprites of different colors.