Google Apps Script Color Space Conversions.

In Google Apps Script Color functions I introduced a bunch of functions to manipulate various color spaces from GAS. This was a migration from the same thing in VBA.

I extended this to include additional color spaces such as Hsl, hsv, Lch, Lab amongst others in VBA from which you can generate a selection of color palettes.  Here’s the Google Apps Script version. This extensive library of color conversions are available in this shared GAS library. I must admit I found the math a little trickier in the GAS version.

5 color pallete

Here’s some random colors and their 5 step palettes generated in GAS according to hue, lightness and saturation using the HSL and CIE-Lch color spaces.

Here’s the code to create these random palettes. You can find the whole thing in this workbook which also uses this shared GAS library 

For more stuff like this, see from VBA to Google Apps Script

(function() {
var po = document.createElement(‘script’); po.type = ‘text/javascript’; po.async = true;
po.src = ‘https://apis.google.com/js/plusone.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(po, s);
})();

Author: brucemcp

Leave a Reply

Your email address will not be published. Required fields are marked *