Creating random, but beautiful, different colors?

Is there any known way to generate random, good and yet distinctive colors? I had worked with this before and knew how to generate colors at random. Nevertheless, they had great chances to be ugly (yellow-brown, green-gray and others), or they were almost the same.

Now, since for measurement, if the two colors are almost the same, it is quite simple to take the color channels and compare the differences between them.

I suspect that I always need to create from 1 to 15 colors.

Change This is for some graphic materials that I create in JavaScript. This may help you understand why I need it.

+4
source share
3 answers

I assume that you randomized in the RGB color space; if you use a different color space, for example. HSB, it is easier to determine if the two colors are similar, and you can limit the range of each axis to eliminate ugly colors.

For example, you can create the first color using:

  • full range of shades
  • full saturation (100%)
  • brightness in the upper 50%

And then a contrasting color using:

  • first color cast +/- certain random value
  • full saturation (100%)
  • brightness in the lower 50%, but maxing at a sufficient distance compared to the first color

The possibilities are endless, but the basic idea is that HSB is a more β€œnatural” color space for randomization, because you control the perceived color properties (hue, saturation, brightness) rather than technical properties (intensity from three channels).

+10
source

I do not know about the choice of individual colors, since "ugly" and "beautiful" are very subjective terms.

On the other hand, color schemes or sets of colors that match each other have some theory, and it is very possible to choose random colors that work well together.

Check out this site: Color Scheme Designer .

+3
source

When implementing HSB for a graphical tool that did mostly linear graphics, I found that the HSB model gave me great control over random color generation, but it was very difficult to find colors that did not look the same when next to each other. I think it was worse for those people with worse vision than mine (older people with trifocals, etc.).

Based on this experience, I recommend that you do not limit yourself to color. Use shapes and patterns along with a hard-coded set of colors that you arbitrarily choose.

+1
source

Source: https://habr.com/ru/post/1397209/


All Articles