got nerd sniped into quantifying the quality of a palette arrangement and performing random swaps to optimize it.
have an algo idea for this one: gradients trade colors with each other. each gradient figures out its least fitting element (high variance relative to quadratic curve) and expels it on a pile. then it picks from the pile the most fitting element. if multiple gradients want the same color, the best fit wins. if no gradient wants a color, that's a new gradient (after two consecutively unwanted colors). self-assembling gradients trading piles.
hmmm. that's almost a point cloud meshing algo...
step 1: we start with a single "gradient" that contains all colors. we fit the set to a 3d line, then sort colors by projected position on the line. then we concat all gradient groups (currently 1) back into the linear palette. the result looks ordered, but has high variance.
now the gradient has to expel its worst samples. i'll try expelling two, which form a new gradient. actually, why not find the mean variance and split the set by that.
now only letting each gradient expel 1 worst sample onto pile if variance is above threshold; each pile color is then auctioned off to the gradient whose variance it would improve the most, by a factor. then all gradients smaller than 3 are broken up and their colors put on the pile. if the pile size is >= 3, it becomes a new gradient. otherwise we run again.
clearly only the very first gradient benefits from this, others don't grow, and we end up with 104 tiny gradients.
hmhm.