Title bar colors
3 years ago
When I first made Comet, I realized how difficult it is to make a website that stands out in terms of appearance. I wanted the site to be visually interesting and unique, so I decided to make the site's color scheme change slightly depending on what photos were being shown. The end result was post title bars that shifted in color from post-to-post.
To do this, I made use of a method known as k-means clustering. This technique essentially scans through an image to find its most common colors. Depending on how rigorous that scan is, this can take a computer between a fraction of a second and a few minutes. On the new version of Comet, I had to program the k-means detection to work on a separate "thread", otherwise the entire website would be unresponsive while an image is being processed.
Teaching a computer identify "interesting" colors is not easy. The site currently looks for colors with high "saturation" (i.e., intense colors), but I am finding it gives mixed results. The site often has to lighten the selected colors so black text can still be legible on top of it. I'd like to experiment with different options when I have more free time.
Now you know a little bit about what goes into those odd colors above each post. I just turned the color detection mechanism back on - it has been turned off for awhile now - so we'll see how it works over the next few days.
By the way - this picture is completely unrelated to the content of this post. This was taken in September of 2011 at an Alzheimer's walk in Western MA. For those who don't know - that white doggo was our family dog, Molly - she was very sweet. This picture is colorful, so I decided to use it for this post.
© 2017. All rights reserved.