I’d like to use Color Thief, a script which allows you to extract the dominant color of an image.
Unfortunately I’m not able to get the code to work. I’d like the do
Murtnowski is correct in saying that the operation will fail if you run it against an image hosted on a different domain. If you are running it on an image hosted on your own domain, you just need to call getColor with an img element rather than a URL:
HTML
JS
var sourceImage = document.getElementById("myImg");
var colorThief = new ColorThief();
colorThief.getColor(sourceImage);