Home  >  Article  >  Java  >  How can you automatically generate N unique and visually distinct colors?

How can you automatically generate N unique and visually distinct colors?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-10-27 19:00:02424browse

How can you automatically generate N unique and visually distinct colors?

How can you automatically generate N unique colors?

Existing methods for automatically selecting distinct colors often fail to produce visually distinct colors, especially when N is large. This question explores alternative approaches.

One approach is to define a piecewise linear function on the RGB cube. This allows for the generation of a progressive scale of colors, but the colors can become similar as N increases. Another approach involves evenly subdividing the RGB cube into a lattice and drawing points. However, this method can be computationally expensive.

More optimal solutions have been developed in academia. For arbitrary N, consider:

  • Colour displays for categorical images
  • A WEB SERVICE TO PERSONALISE MAP COLOURING
  • An Algorithm for the Selection of High-Contrast Color Sets
  • High-contrast sets of colors

For finite and relatively small N, consult:

  • A Colour Alphabet and the Limits of Colour Coding

Predefined color lists include:

  • Boynton's list of 11 colors
  • Kelly's 22 colors of maximum contrast
  • Color lists by MIT student

The above is the detailed content of How can you automatically generate N unique and visually distinct colors?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn