How to generate a color a little darker than some other color?

Hello! I am making a progress bar on my game that shows the completion of a level based on how far the player is from the end. However, my levels’ background colors are randomized, and I would like to have the back of the progress bar (the part that gets filled) a little darker than the background itself. Any ideas?

Thanks in advance.

To get a darker color the simplest way to go about it is lowering the values of R, G and B by the same proportion (ie 10%).

can you access the background color? just store the background color if posible and create a new color take into account that the closer their rgb values gets to 0 the darker it will be

Color color = new Color(background.r - amount, background.g - amount, background.b - amount);

use that color for the progressbar :slight_smile: