Image Sampler- Black and white Pattern to specific colors

Hi all, I am writing a script to convert a simple black and white pattern to 4 specific colors that I define! Basically, what OMA did for Galleria in Gwanggyo.

I tried to subdivide the output data from black and white image sampler and then apply a color to each sub list but doesn’t work for me! Really appreciate it if anyone knows the best way to solve this!!
I have attached the script if it helps. (219.4 KB) (189.2 KB)

ImageSampler_BWtoColor_2020Oct21a [Oct-21 '20, 1233].gh (195.5 KB)

Amazing.Thank you!!

Awesome.Thank you!!

This version is not constrained by a list of colors, which might have been your primary intention but wasn’t constrained that way in my model. So now I generate as many colors as specified by a ’Count’ slider.

Odd that a word in the graphic slips through too easily now… higher resolution. (192.2 KB)