G'MIC Challenge - All RGB

Maybe this can help :
The following command finds a colormap of the most different colors than the one present in the input image.
Use it like this: $ gmic sp lena +non_colormap 16.

non_colormap : check "${1=32}>0"
  e[^-1] "Compute a $1-entry colormap of the most different colors from image$?."
  v - repeat $! l[$<]
    64,64,64,1 eval.. "col = [R,G,B]*(w#-1-1)/255; i(#-1,col) = 1" rm..
    $1,1,1,3
    repeat w # Find colormap by maximal color distance from existing points
      +distance.. 1 col={[xM,yM,zM]} rm.
      point.. $col,1,1
      point. $>,0,0,1,{[$col]/w#-2*255}
    done rm..
    l. +luminance. rv a y sort. +,x rows. 1 round endl # Sort colormap by increasing luminance
  endl done v +