# What is the least common colour used on web pages?

**URL:** <https://discuss.httparchive.org/t/what-is-the-least-common-colour-used-on-web-pages/1085>\
**Category:** Analysis\
**Created:** [September 27, 2017, 5:26pm UTC](https://discuss.httparchive.org/t/what-is-the-least-common-colour-used-on-web-pages/1085 "2017-09-27T17:26:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rviscomi](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/rviscomi/32/835_2.png) [@rviscomi](https://discuss.httparchive.org/u/rviscomi)\
**Post date:** [September 27, 2017, 5:26pm UTC](https://discuss.httparchive.org/t/what-is-the-least-common-colour-used-on-web-pages/1085/1 "2017-09-27T17:26:18Z")

</div>

On Twitter, [@v21](https://twitter.com/v21) asks:

> <https://twitter.com/v21/status/911963557763407872>

Does anyone want to take a stab at researching this one? 🤠

---

<div class="post-metadata">

**Author:** ![paulcalvano](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/paulcalvano/32/1601_2.png) [@paulcalvano](https://discuss.httparchive.org/u/paulcalvano)\
**Post date:** [September 28, 2017, 2:15am UTC](https://discuss.httparchive.org/t/what-is-the-least-common-colour-used-on-web-pages/1085/2 "2017-09-28T02:15:31Z")

</div>

I think one of the challenges here is that the least used color will be used just once. And there are many colors that appear to be used only once.

I ran the following query to extract color hex strings from CSS files the request\_bodies table, and it returned a list of 88,231 unique color combinations. (Note: this doesn’t factor colors set by HTML and JS). The query I ran below, although be warned that it will chew through 770GB of processed data…

```sql
SELECT color, count(*)
FROM (
  SELECT page, url, REGEXP_EXTRACT(LOWER(body), r'color[\s]?:[\s]?#([A-Fa-f0-9]+)') AS color
  FROM httparchive.har.2017_09_01_chrome_requests_bodies
  WHERE url LIKE "%.css" 
) GROUP BY color

```

The Regex match is basically looking for `color:#FFFFFF`, where `FFFFFF` is any hex string, and spaces are optionally allowed before/after the `:` character.

Out of 88,231 unique colors, 64,335 of them were used only once! Since there’s a lot of colors tied for last place, I don’t think this can be answered. 🙂

BTW - the most common color is #FFFFFF (and it’s shorthand #FFF), which is just white. I’m guessing that I caught a lot of background colors in my search!

Another interesting tidbit I ran into while looking at this is the length of the color codes. I was surprised to see that the shorthand RGB codes are used slightly more than the 6 char RRGGBB versions.

![image](https://canada1.discourse-cdn.com/flex035/uploads/httparchive/original/1X/74afc91f713de508e5bd4605116bfab91d938067.png)

---

<div class="post-metadata">

**Author:** ![paulcalvano](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/paulcalvano/32/1601_2.png) [@paulcalvano](https://discuss.httparchive.org/u/paulcalvano)\
**Post date:** [September 28, 2017, 2:40am UTC](https://discuss.httparchive.org/t/what-is-the-least-common-colour-used-on-web-pages/1085/4 "2017-09-28T02:40:08Z")

</div>

Actually, looking at the [REGEXP\_EXTRACT documentation](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#regexp_extract) this is only capturing the first CSS color in each URL. Anyone know of a way to extend this to capture all of them? I tried replacing REGEXP\_EXTRACT with REGEXP\_EXTRACT\_ALL, but it didn’t seem to return any results.

---

<div class="post-metadata">

**Author:** ![paulcalvano](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/paulcalvano/32/1601_2.png) [@paulcalvano](https://discuss.httparchive.org/u/paulcalvano)\
**Post date:** [September 28, 2017, 11:30am UTC](https://discuss.httparchive.org/t/what-is-the-least-common-colour-used-on-web-pages/1085/5 "2017-09-28T11:30:52Z")

</div>

Ah ha! I just learning something new today :). Reading up on working with arrays in BigQuery here - [https://cloud.google.com/bigquery/docs/reference/standard-sql/arrays](https://cloud.google.com/bigquery/docs/reference/standard-sql/arrays).

Here’s an updated query that accounts for all colors in the CSS files:

```sql
SELECT color, count(*) color_count
FROM
(
  SELECT REGEXP_EXTRACT_ALL(LOWER(body), r'color[\s]?:[\s]?#([A-Fa-f0-9]+)') colors
  FROM httparchive.har.2017_09_01_chrome_requests_bodies
  WHERE url LIKE "%.css" 
) color_arrays
CROSS JOIN UNNEST(color_arrays.colors) color
GROUP BY color
ORDER BY color_count DESC

```

So now I have a list of 1,728,903 unique colors used on the web. Ultimately, I came to the same conclusion as before with the least common color though. There are 604,286 colors that are used exactly once across all sites. That’s a lot tied for last place. We could take this one step further and look for a color used exactly once on the lowest Alexa ranked site - but there are numerous sites in the HTTP Archive that have a null rank - so that would also produce numerous colors tied for last place!

BTW - the most frequent color is white if you combine #FFF and #FFFFFF. Next is black (#0).

![image](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/httparchive/original/1X/d8bd0532a59cf738ee1a5c66bdfcb4bc1e0f596f.png)

and because treemaps are so much fun to explore this type of data with -  
 ![image](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/httparchive/original/1X/00128d205a5f55f2c8b7a8d7caa8d783f3c3e225.png)

Lastly, I mentioned above that the length of the color code seemed interesting. Looking at the full dataset, I see 39% of color codes are #RGB while 61% are #RRGGBB

![image](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/httparchive/original/1X/39d889d7422f6f977e35c64694e8f682f2649777.png)

---

<div class="post-metadata">

**Author:** ![rviscomi](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/rviscomi/32/835_2.png) [@rviscomi](https://discuss.httparchive.org/u/rviscomi)\
**Post date:** [September 29, 2017, 5:15pm UTC](https://discuss.httparchive.org/t/what-is-the-least-common-colour-used-on-web-pages/1085/6 "2017-09-29T17:15:59Z")

</div>

This is really cool, thanks for digging into this Paul! A couple of observations:

`WHERE url LIKE "%.css"`

This restricts the search to files ending in `.css` but people frequently use cache-busting parameters after the file extension. You could work around that by changing the clause to `WHERE url LIKE "%.css%"` but that brings me to my next thought. HTML documents can also have inline style blocks. So maybe instead of matching file extensions, you could look at the content type of the response and filter out resources that aren’t html or stylesheet.

`r'color[\s]?:[\s]?#([A-Fa-f0-9]+)'`

This is limited to colors represented in hex, but there are many other representations (hsl, rgba, color name). If your regex fu is strong, you could try extracting just the style value after the `color` name and grouping by the values. Should also strip out things like `!important`. One interesting analysis may just be to limit the query to color names (black, white, red, palegoldenrod, etc). Since the list is finite it may be easier to query against a whitelist. That was mentioned in the tweet thread, so it may be the original intent.

---

<div class="post-metadata">

**Author:** ![patrickhulce](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/patrickhulce/32/780_2.png) [@patrickhulce](https://discuss.httparchive.org/u/patrickhulce)\
**Post date:** [September 30, 2017, 12:54am UTC](https://discuss.httparchive.org/t/what-is-the-least-common-colour-used-on-web-pages/1085/7 "2017-09-30T00:54:41Z")

</div>

Did some more analysis to bucket the colors from Paul’s data down to just 125 and find the most common ones.

White/black/grey dominates the top with moderate blues and reds with neon greens, purples, pinks dominating the bottom. Interesting stuff!

![image](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/httparchive/original/1X/c1454f0e4651f5acf01f2b09b37d31a2d98ad26a.png)

[gist](https://gist.github.com/patrickhulce/2f8a18a792661b35c556b56a63e136d1)

---

<div class="post-metadata">

**Author:** ![dmittleman](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.httparchive.org/dmittleman/32/2131_2.png) [@dmittleman](https://discuss.httparchive.org/u/dmittleman)\
**Post date:** [May 3, 2023, 3:19pm UTC](https://discuss.httparchive.org/t/what-is-the-least-common-colour-used-on-web-pages/1085/8 "2023-05-03T15:19:40Z")

</div>

This question was answered in the Web Almanace 2022 CSS Survey.

> **[CSS | 2022 | The Web Almanac by HTTP Archive](https://almanac.httparchive.org/en/2022/css#colors)**
>
> CSS chapter of the 2022 Web Almanac covering trends, changes, and patterns in CSS use across the web.

They sampled sites and found the least used named color was mediumspringgreen.
