What is new?
Every link on this homepage is now colored based on the dominant color of a related image. Blog posts for example take the primary color from their teaser image. Links on the blog roll are colored according to the teaser image of the posts they link to. Some other pages such as the home page or the projects page use a custom default color.
You can use the navigation links on the bottom of this page to jump through the older posts in chronological order. I really like how each post has its own color scheme now! Even the Discuss comments are tinted according to the header picture.
How does it work?
I wrote a little Vala program called “color_extractor” which is automatically executed when I upload this website to github. The source code of the color_extractor is available here. This program extracts a dominant color from each picture used on this website. It stores the colors in a file as a sass map. This file looks like this:
This sass map is included in my main.scss file and with some loops converted into several css classes. Finally, I only have to specify the color which should be used by the entire page in the front matter of each post or page. For example:
Then this will be written as a class into the body tag of each page:
On the blog roll page where each post is colored differently, the class is assigned to each post preview container: