I am using a library called Colorthief that can return the dominant color of an image. I use this function to set the background color of three buttons, like this: