# Meta attribute theme-color uses the default header background color, not the active one

**URL:** https://meta.discourse.org/t/meta-attribute-theme-color-uses-the-default-header-background-color-not-the-active-one/96727
**Category:** Bug
**Created:** [September 8, 2018, 10:17am UTC](https://meta.discourse.org/t/meta-attribute-theme-color-uses-the-default-header-background-color-not-the-active-one/96727 "2018-09-08T10:17:57Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![gkln](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gkln/32/293382_2.png) [@gkln](https://meta.discourse.org/u/gkln)
#### Post date: [September 8, 2018, 10:17am UTC](https://meta.discourse.org/t/meta-attribute-theme-color-uses-the-default-header-background-color-not-the-active-one/96727/1 "2018-09-08T10:17:57Z")

</div>

Hi,

When users select another theme in their settings, the meta attribute `theme-color` is still set to the `header_background` property of the default theme. It should be set to the value of the active theme instead.

Thanks in advance for looking into this.

(Running Discourse v2.0.5.)

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [September 11, 2018, 9:46am UTC](https://meta.discourse.org/t/meta-attribute-theme-color-uses-the-default-header-background-color-not-the-active-one/96727/2 "2018-09-11T09:46:45Z")

</div>

I had this reported yesterday on another forum.

The `theme-color` tag is used by Chrome on android to style tabs according to the website’s color scheme.

> **[Support for theme-color in Chrome 39 for Android  |  Blog  |  Chrome for...](https://developer.chrome.com/blog/support-for-theme-color-in-chrome-39-for-android)**
>
> Use theme-color to set the toolbar color in Chrome for Android.

As @gkln said, this seem to have stopped working properly for Discourse sites. Looking at the code, I’m not sure if/how it ever fetched colors from a non-default theme, but it can’t be a coincidence that two separate people have reported it 🤔. @osama maybe something related to the recent theme changes?

> <https://github.com/discourse/discourse/blob/main/app/views/layouts/_head.html.erb#L12>

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [September 11, 2018, 2:22pm UTC](https://meta.discourse.org/t/meta-attribute-theme-color-uses-the-default-header-background-color-not-the-active-one/96727/4 "2018-09-11T14:22:50Z")

</div>

The `theme-color` meta attribute always used the site’s default color scheme instead of the scheme of the current user theme. We’ve had this bug since the inception of user-selectable themes. Here is a fix for it:

[https://github.com/discourse/discourse/pull/6384](https://github.com/discourse/discourse/pull/6384)

@gkln thanks for reporting this ancient bug!

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [September 11, 2018, 2:25pm UTC](https://meta.discourse.org/t/meta-attribute-theme-color-uses-the-default-header-background-color-not-the-active-one/96727/5 "2018-09-11T14:25:19Z")

</div>

@Osama should we also set the user selected color in the [https://meta.discourse.org/manifest.webmanifest](https://meta.discourse.org/manifest.webmanifest) ?

---

<div class="post-metadata">

### Author: ![Osama](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osama/32/98013_2.png) [@Osama](https://meta.discourse.org/u/Osama)
#### Post date: [September 11, 2018, 3:05pm UTC](https://meta.discourse.org/t/meta-attribute-theme-color-uses-the-default-header-background-color-not-the-active-one/96727/6 "2018-09-11T15:05:42Z")

</div>

Yep, looks like [Google docs](https://developers.google.com/web/fundamentals/web-app-manifest/) recommend the colors in `theme-color` meta attr and the manifest file match, so I updated my PR so that the manifest file uses the same colors.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [September 11, 2018, 6:08pm UTC](https://meta.discourse.org/t/meta-attribute-theme-color-uses-the-default-header-background-color-not-the-active-one/96727/7 "2018-09-11T18:08:27Z")

</div>


