#Correctly adjust color's brightness

1 messages · Page 1 of 1 (latest)

mortal knoll
#
Color.RGBToHSV(_initialColor, out float h, out float s, out float v);

float percent = value / 100f;

v *= 1 + percent;
s *= 1 - percent;

_color = Color.HSVToRGB(h, s, v);

The solution is to also multiply the HSV's saturation (s).
This works on all colors but full black, since there is nothing to multiply ((0, 0, 0))

#

What is also to note is that the color's alpha is to be set to the initial one's, since it's overriden to 1 on convention

mortal knoll
#

Writing this if someone faces the same issue in the future. In this case, write me for the source code.