https://www.c82.net/blog/?id=82 C82: Works of Nicholas Rougeux * Home * Work * Blog * About * Search [ ] Making of Goethe's Colours By Nicholas Rougeux, posted on January 12, 2020 in Art, Web Closeup of visualization Figuring out how to put a new face on something old is never easy and devising a new way to look at Goethe's Theory of Colours was no exception. What started as a relatively simple idea turned out to be more complex that I expected but the process was a good learning experience. The final result is fun too. I've analyzed my fair share of antique texts and each time I find a new one to explore, I find it both daunting and exciting to explore looking at it in new ways. I tried dozens of ideas for Goethe's Colours before finally settling on one. As is often the case, it's I don't know what works until I see it so a lot of experimenting is needed. In 1810, the German statesman and and writer Johann Wolfgang von Goethe explored the psychology of colors and how they're perceived by humans in Theory of Colours. While mostly rejected by the scientific community, it was embraced by and influenced philosophers and artists. The book had come across my radar several times in doing research for other projects and this time around, it piqued my interest enough to explore ways of visualizing its contents. Considering the book is all about colors, I chose to focus on the colors themselves--specifically, which ones were mentioned and when. My assumption was that the book would discuss many colors and visualizing this could prove interesting. I don't speak German so I chose to use the 1840 English translation available on both the Internet Archive and Project Gutenberg. I was surprised to learn that while this was ultimately true, not as many colors were mentioned as I expected. Of the 95,000+ words spanning 471 pages, there were only 1,851 mentions of colors by name (e.g. "red," "yellow," etc.) and only 191 unique names used to reference these colors (e.g. "red," "yellow-green," "gold," etc). Finding colors One of the first tasks for any data-driven project is to look at the raw data. Like many of my projects, I needed to generate these data myself. I used the text on Project Gutenberg as my primary source of data and since it was marked up in HTML my goal was to do the parsing in JavaScript to avoid reshaping the original data into another format. I skimmed through the book and I saw that the most common names of colors like "red," "orange," "yellow," etc. were used most frequently so I started by simply doing a search for how often each occurred using a very basic regular expression in JavaScript: red[\. ]|orange|yellow|green|blue|purple|brown|black|white|grey The red[\. ] was an initial attempt at catching variations on its usage such as, "redder," "reddish," or anything else with the word "red" in it. This had its own issues but this first test was a good glimpse into the volume and variety of data available. Early visualization attempt Screenshot of the first view sequence of basic colors An early picture of the data using circles to represent the sequence of basic color names as they appeared in the book Determined to find all the colors with a regular expression rather than manually finding each one, I started trying out other names for colors and variations on names to see what else appeared. I found many others but there was no getting around the need for a manual review. I couldn't help but think that some text analysis and machine learning would have made the process more efficient and interesting but in lacking the knowledge of how to get that working, I forged ahead with the manual approach. I eventually settled on the following long-winded regular expression. It could probably have been streamlined more but it did the job for what I needed. ( ( ( blood |bright |burnt |citron |dark |deep |dull |emerald |hyacinth |light |nearly |pale(st)? |pearly |prussian |pure |quiet |sea |spanish |silver |subdued |(?&lgt;![a-z])sky |vegetable |vivid |warm ) (e(r|st))?+ (.*<\/span>)? ( |-|\n|\r)? )? ( bianchezza |bianco |black(er|ish|ness)? |bleu |blue |bluer |bluish |brown(er|ish)? |carmine |copper |coral |cramoisi |crimson |cyaneum |(flavum( |-|\n|\r)saturum) |flesh-colour |(florido( |-|\n|\r)flavo) |gelb(en)? |(? However, each time the iframe's source changed, Safari and mobile Safari scrolled the parent window down seemingly random amounts, thereby causing the page that was clicked to scroll out of frame. After a few headaches and unsuccessful searches, I found that using a querystring and then some extra code on the page loaded into the iframe to parse that and scroll to the desired position worked without affecting the parent window. This extra code also had to hijack the other anchor links on the page that linked to other parts like footnotes and other sections. I admit it's a strange workaround but it works. $("a").on("click touch", function(){ newScroll($(this).attr("href")); return false; }); Finally, I added a simple chart at the bottom of the page showing the total times each color was mentioned with the ability to drill down to see which names were used. Design concepts Screenshots of the chart showing how often all generic (left) and orange names (right) were used Final thoughts I began this project thinking it would be fun simple project to see how often colors were referenced in a book all about them. As usual, it became much more involved with many design ideas and programming challenges. A few headaches were encountered along the way but I'm pleased with the final result and hope others are as well. Explore the project >> << Back to blog * * * * * * * Subscribe for updates Get notified when new projects are released. Your email will not be sold or given to anyone else. [ ] Email address [ ] [Subscribe] (c)2000-2022 Nicholas Rougeux. All rights reserved. Terms of use