Calculating the dominant colour of an image and setting the background colour accordingly works better than a fixed background colour. Especially when images have variable shapes, portrait or landscape orientation and must look well full-screen on various devices.
Sampling the image colours and calculating the right one for the background can be done on server or client-side, For my custom gallery-slider I have created both:
- server side (PHP)
There are pros and cons of each of the solutions and the choice will depend on application, number and size of images, origin of images etc.
Following there is a video with a quick demo of the slider:
The code is coming soon :-)