How it works

The dominant colours are extracted from the image using colof-thief. These colours are then compared against pre-calculated (also using color-thief) colours for each of the shades of yarns in the selected range, using the CIELAB delta E 2000 colour difference algorithm.

To see the pre-calculated colour choices, select a yarn range and click the button.

Source code

The source code for Yarn Palette is available on github.