For all the talk of American exceptionalism, there is at least one thing that is unexceptional about the United States: it’s flag. The Star-Spangled Banner’s particular shade of red shows up in 14.3 percent of all national flags, making it the second most common color after white. And the dark blue of the American flag’s canton is also shared by 13 other nations.
In fact, the world’s 196 countries stick to a surprisingly small palette when it comes to picking their flags. The most popular shade of yellow, for example, shows up in the flags of Lithuania, Columbia, Ghana, St. Lucia and Vietnam, among many others, giving it a foothold on five continents and making it third most popular individual shade. (Overall, blues and greens are more popular than yellows.)
Sometimes, it’s not just the colors that seem familiar. In perhaps the most famous example of two countries showing up somewhere wearing the same outfit, Liechtenstein and Haiti both arrived at the 1936 Olympics flying identical banners.
The complete code used to generate this data, which uses Mathematica 10, is available on the Wolfram Cloud.
After downloading the 196 flag images from Flagpedia.net, we added up the total number of pixels of each color. This yielded 527 different shades across 36.6 million pixels. Because digital images are only approximations of the colors in the physical flags, we decided it was safe to further simplify these colors down to the traditional “web safe” palette of 216 possible colors. That reduced the number of distinct shades from 527 to 63.
These 63 colors were then grouped into parent categories of white, black, red, blue, green and yellow using a simple algorithm to determine which parent color each shade most resembled. This process required a small about of manual tweaking for colors on the border between green and blue.