Limiting input type="colour" to a certain palette (from an image)

This is a demo page for the blog post on

The heavily annotated source code is here.

Simple limitation:

Import palette from image

Try it by clicking the images below and then checking the colour picker.

Alternatively Drag and Drop an image onto the document, paste it, or use the upload bar below.