Following up on my comment (for posterity). I've now released the new code to my library. Includes a demo of using the full range of CSS color strings to set color in the canvas[1], and also a demo of my reducePalette (with dithering) filter[2] - I've no idea if the filter's output is 'Good Enough' for Image Engineering work, but I'm happy with the results.
[1] - https://scrawl-v8.rikweb.org.uk/demo/canvas-059.html
[2] - https://scrawl-v8.rikweb.org.uk/demo/filters-027.html