Generate distinctly different RGB colors in graphs

前端 未结 12 1225
故里飘歌
故里飘歌 2020-11-30 16:51

When generating graphs and showing different sets of data it usually a good idea to difference the sets by color. So one line is red and the next is green and so on. The pro

12条回答
  •  南方客
    南方客 (楼主)
    2020-11-30 17:26

    I have put up a page online for procedurally generating visually distinct colors:
    http://phrogz.net/css/distinct-colors.html

    Unlike other answers here that evenly step across RGB or HSV space (where there is a nonlinear relationship between the axis values and the perceptual differences), my page uses the standard CMI(I:c) color distance algorithm to prevent two colors from being too visually close.

    The final tab of the page allows you to sort the values in several ways, and then interleave them (ordered shuffle) so that you get very distinct colors placed next to one another.

    As of this writing, it only works well in Chrome and Safari, with a shim for Firefox; it uses HTML5 range input sliders in the interface, which IE9 and Firefox do not yet support natively.

提交回复
热议问题