Generating random colours from an array
I use a few different ways to generate random colours for my random projects. They result in different colour moods. RGB for instance is much more colourful than HSL. Very dark, very light, and unsaturated colours are not common when you generate random RGB. They are very common when you generate HSL though. And both will have relatively many green results.
For my Daily Dwagd project I use both HSL and RGB to generate the random colours to overcome the limitations of both techniques. Yet still I wasn’t happy with the results. I do like RGB, since it results in very colourful objects, but I think HSL is too dull, too dark, too light and too green. When you think about it, this makes sense: All results with a hue between 70 and 163 are green. That’s one in four. One in five results are very dark. And one in three are really unsaturated. So I created a slightly different way to generate colours.
I pick a random item from an array with the values red, orange, yellow, green, cyan, blue, indigo, purple, magenta, rose, dark, light and gray. And then it generates a colour within that hue.. It results in much more variation than RGB, and it also looks a bit more random than HSL.