Move HTML color generation into the Pixel object.

Also add an AveragePixel object to avoid computations in the server code.