How to programmatically arrange a set of 256 RGB colors in 2D so that there all adjacent colours have a smooth transition

1.5k views Asked by At

I have a set of 256 colors (all available colors in an xterm-256color terminal) and I am using a script called 256colors2.pl that I see mentioned in nearly every Internet article that talks about 256 color terminals. This is script's output is a 6x6x6 color cube laid out as a series of 6 6x6 slices of the cube, plus a line with grays from black to white.

What I am looking for is some 2D shape, and the corresponding algorithm to lay out these colors in 2D so that all the transitions are smooth. This should be applicable to a reduced set of colors (256 in this case, which includes a limited set of grays).

1

There are 1 answers

0
Dawood On

Just a thought (I don't have a technical solution or algorithm for this)... you'd probably want to consider a color wheel. It's commonly used in graphic and imaging applications when the user wants to select a color.

Reference: http://en.wikipedia.org/wiki/Color_wheel

Here are some related posts:

  • Function for creating color wheels
  • http://www.javascriptsource.com/page-details/hexadecimal-color-wheel.html