 <p>I'd take a screenshot, then make a histogram of the image to find the most common colour.</p> <p>Refinements:</p> <ul> <li>First go through and replace all text content with "&amp; nbsp;"</li> <li>Give extra weight to the pixels closest to the edge of the screen.</li> </ul> <p>(To automate entirely within PhantomJS, you might be able to use something like <a href="http://html2canvas.hertzen.com/" rel="nofollow">http://html2canvas.hertzen.com/</a> to use a canvas, and never need to make an external image file.)</p>