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


#1

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.)


(David Taylor) #2

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.

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 :thinking:. @osama maybe something related to the recent theme changes?


#4

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:

@gkln thanks for reporting this ancient bug!


(Rafael dos Santos Silva) #5

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


#6

Yep, looks like Google docs 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.


(Jeff Atwood) #7