Color Matching in GAS


I covered the mathematics of color matching in the VBA implementation in  Find nearest color match. This is the Google Apps Script implementation. I'll be using the CIEDE2000 algorithm to measure the distance between colors. 

One thing I discovered was that GAS is rather slow compared to plain javaScript or VBA for these compute intensive tasks so I can achieve a lot less before I run out of allocated compute time.

The source and data are the heatMap workbook described in Playing around with GAS color, and much use is made of a shared library, see - Using the mcpher library in your code

Color Table matching

In Looking up color table I've built up a table of schemes such as Pantone, dulux etc through various web scraping sessions, and now have getting on for 10,000 named colors in that library. Here's the GAS attempt at finding the closest matches to some random colors in a couple of the color schemes. 




The gory details

These are implemented in Playing around with GAS color. Here's the color match algorithm section.

comparing colors use CIE algorithm


and here' the test procedure that generated the above

comparing colors test procedure

Transitioning is covered more comprehensively in my my book, Going Gas - from VBA to Apps script, available All formats are available now from O'Reilly,Amazon and all good bookshops. You can also read a preview on O'Reilly.






Comments