Im trying to come up with a way to add a new unused color to an array on click.
Constraints:
I can't have a predefined array of colors as I dont know how many times the user will click.
Every new color generated should be different from any other one in the array.
Each new color should be a relatively different color from the previous one in the array. Meaning if the previous color is reddish-orange, the current one shouldn't be a reddish-pink or yellowish-orange.
I'm wondering if there is an intuitive or mathematical way to go through RGB values where I can get a new color and not have to iterate through the entire array each time to see if that color exists. I already thought of using a hash, but wanted to see if there was any other method.