Saturday, March 12, 2022

[eexymbii] color palettes

some widely separated points in the RGB color cube.  previously, the right way to do this, using the Cielab color space.

8 colors (cube vertices): rgb(0,0,0)=  , rgb(0,0,255)=  , rgb(0,255,0)=  , rgb(0,255,255)=  , rgb(255,0,0)=  , rgb(255,0,255)=  , rgb(255,255,0)=  , rgb(255,255,255)=  

9 colors (8 colors + gray): rgb(0,0,0)=  , rgb(0,0,255)=  , rgb(0,255,0)=  , rgb(0,255,255)=  , rgb(255,0,0)=  , rgb(255,0,255)=  , rgb(255,255,0)=  , rgb(255,255,255)=  , rgb(128,128,128)=  

12 colors (vertices + 3 gradations of green): rgb(0,0,0)=  , rgb(0,0,255)=  , rgb(0,128,0)=  , rgb(0,128,255)=  , rgb(0,255,0)=  , rgb(0,255,255)=  , rgb(255,0,0)=  , rgb(255,0,255)=  , rgb(255,128,0)=  , rgb(255,128,255)=  , rgb(255,255,0)=  , rgb(255,255,255)=  

13 colors (12 colors + gray): rgb(0,0,0)=  , rgb(0,0,255)=  , rgb(0,128,0)=  , rgb(0,128,255)=  , rgb(0,255,0)=  , rgb(0,255,255)=  , rgb(255,0,0)=  , rgb(255,0,255)=  , rgb(255,128,0)=  , rgb(255,128,255)=  , rgb(255,255,0)=  , rgb(255,255,255)=  , rgb(128,128,128)=  

18 colors (3 gradations of red, green): rgb(0,0,0)=  , rgb(0,0,255)=  , rgb(0,128,0)=  , rgb(0,128,255)=  , rgb(0,255,0)=  , rgb(0,255,255)=  , rgb(128,0,0)=  , rgb(128,0,255)=  , rgb(128,128,0)=  , rgb(128,128,255)=  , rgb(128,255,0)=  , rgb(128,255,255)=  , rgb(255,0,0)=  , rgb(255,0,255)=  , rgb(255,128,0)=  , rgb(255,128,255)=  , rgb(255,255,0)=  , rgb(255,255,255)=  

19 colors (18 colors + gray): rgb(0,0,0)=  , rgb(0,0,255)=  , rgb(0,128,0)=  , rgb(0,128,255)=  , rgb(0,255,0)=  , rgb(0,255,255)=  , rgb(128,0,0)=  , rgb(128,0,255)=  , rgb(128,128,0)=  , rgb(128,128,255)=  , rgb(128,255,0)=  , rgb(128,255,255)=  , rgb(255,0,0)=  , rgb(255,0,255)=  , rgb(255,128,0)=  , rgb(255,128,255)=  , rgb(255,255,0)=  , rgb(255,255,255)=  , rgb(128,128,128)=  

27 colors (3 gradations of all): rgb(0,0,0)=  , rgb(0,0,128)=  , rgb(0,0,255)=  , rgb(0,128,0)=  , rgb(0,128,128)=  , rgb(0,128,255)=  , rgb(0,255,0)=  , rgb(0,255,128)=  , rgb(0,255,255)=  , rgb(128,0,0)=  , rgb(128,0,128)=  , rgb(128,0,255)=  , rgb(128,128,0)=  , rgb(128,128,128)=  , rgb(128,128,255)=  , rgb(128,255,0)=  , rgb(128,255,128)=  , rgb(128,255,255)=  , rgb(255,0,0)=  , rgb(255,0,128)=  , rgb(255,0,255)=  , rgb(255,128,0)=  , rgb(255,128,128)=  , rgb(255,128,255)=  , rgb(255,255,0)=  , rgb(255,255,128)=  , rgb(255,255,255)=  

16 colors named in HTML 4.01: rgb(255,255,255)=  , rgb(192,192,192)=  , rgb(128,128,128)=  , rgb(0,0,0)=  , rgb(255,0,0)=  , rgb(128,0,0)=  , rgb(255,255,0)=  , rgb(128,128,0)=  , rgb(0,255,0)=  , rgb(0,128,0)=  , rgb(0,255,255)=  , rgb(0,128,128)=  , rgb(0,0,255)=  , rgb(0,0,128)=  , rgb(255,0,255)=  , rgb(128,0,128)=  

set difference of the 27-color set minus the 16-color set (12 colors not present in the 16-color set): rgb(0,128,255)=  , rgb(0,255,128)=  , rgb(128,0,255)=  , rgb(128,128,255)=  , rgb(128,255,0)=  , rgb(128,255,128)=  , rgb(128,255,255)=  , rgb(255,0,128)=  , rgb(255,128,0)=  , rgb(255,128,128)=  , rgb(255,128,255)=  , rgb(255,255,128)=  

instead of appending gray rgb(128,128,128) in the sets above, perhaps it would have been better to append the silver rgb(192,192,192) of HTML 4.01.

Haskell source code to generate HTML for this post.  we use list as the nondeterminism monad, "iterating" over ranges with Monad.replicateM and sequence:

range2 = [0,255];

range3 = [0,128,255];

set8 :: [Color];
set8 = Monad.replicateM 3 range2 & map Color;

set12 :: [Color];
set12 = [range2, range3, range2] & sequence & map Color;

No comments :