Linearly increasing color darkness algorithm
I want to write a function in ruby ββthat gives a number from 1 to 500, produces a six-digit six-color code that gets darker for higher numbers. It's not that hard, but I'm not sure where to start. How to implement this?
change
Tint seems to be a more reliable way. I would like to give a control color, like a tint of green, and then darken or lighten it based on the input number.
input: 10
output: color code (in rgb or HSV) which is the lighter shade of the reference color
input: 400
output: color code (in rgb or HSV) which is a rather dark shade of the reference color
change 2
The only reason I need to use 1 to 500 is because I have to work with. It is good if some cards that are close to each other correspond to the same color.
source to share
If you only want to darken your reference color, this is easy. Given the R, G, B color which is the brightest you want to increase, multiply each of the three values ββby (500-input) and divide by 499. Convert each of the values ββto 2 hex digits and add them with # to the front.
source to share