Issue Summary: Color Palettes Loading Incorrectly with 2.7.0.beta5
After updating to 2.7.0.beta5, users smrtey and gkln reported that their color palettes were not loading correctly. The default “Light” palette was being used instead of the assigned palette. This issue occurred when using theme components, but not with the base theme.
Troubleshooting and Workarounds
smrtey found a temporary workaround by manually adding the desired sass color variables to each theme and component.
awesomerobot suggested disabling components one by one to identify any silent errors.
smrtey discovered that the issue occurs with any component using scss color variables.
Updating to the latest version should resolve the issue.
It is recommended to update theme components to use CSS custom properties instead of SCSS variables, which will enable automatic dark mode and make color overrides easier.
Updated to 2.7.0.beta5 this morning and lots of colors had changed. Looks like the Color Palette isn’t being read correctly and the default color palette that you get when you click on New Palette is being used instead. The two themes below use two different color Palettes, but both end up with the Discourse “New Color Palette” → Base palette: Light defined in the first line of the CSS
If I start with a blank new theme and add a palette, it works as expected, but for my existing themes, the Default Light Palette gets loaded instead of the Palette that is assigned.
It seems like what’s happening is that it loads the correct palette for the base theme, but not for any of the components. So the parts of the page that don’t use a component have the correct colors, but the parts that rely on a component load the default Discourse “Light” palette instead of using the palette that’s assigned to the Theme.
From Developer Tools
color_definitions.scss has the correct palette
Thanks @gkln and @smrtey for the additional details… one thing to try is to disable components one by one to see if that changes anything… It’s possible there’s a silent error that’s not being called out somewhere, and that may be breaking CSS for components.
It seems to happen with any component that uses scss color variables. Everything works fine if I manually add the colors to every individual component:
but that is far from an ideal solution. I don’t see how I can troubleshoot this. There is absolutely no way I have the capacity to figure out what could make Discourse load a different color palette.
ok, @pmusaraj took a closer look and found the bug… it has been fixed here:
…so updating your sites again should fix it.
If these are theme components you’ve built, we recommend updating them to use CSS custom properties instead of our SCSS variables. The switch means you can use automatic dark mode, and makes color overrides easier. More details here: