This version is old school.
Please find jQuery plugins on npm.
imgcolr grabs image color
by Sway Deng
imgcolr is a plugin for grabbing the dominant color of a given image's borders. By using it, you can make the web more interesting, for example, create a slider that the page's background color is dynamicly adapted for the current image, with a few lines of code.