Theme component color definitions broken

AI-generated summary

A user, fuzzyk, is experiencing issues with theme component color definitions not loading in the browser after upgrading to Discourse 2.7.0.beta4. Despite defining colors in SCSS, the browser reports them as unknown. Further investigation by fuzzyk reveals that changes to theme component color definitions do not propagate to the theme, suggesting a bug. This was confirmed by pmusaraj, who apologized for the issue and provided a fix in the form of a GitHub commit: https://github.com/discourse/discourse/commit/bfa3e24e48ef7eb7d4c2c31e2f9d71e436e1f25c.

I cannot get color definitions in theme components to load. They simply never arrive in the browser.

I tried to migrate to color definitions because my themes broke with the recent 2.7.0.beta4 upgrade.

I have the following color definitions in multiple theme components (hence multiple code blocks):

:root {
    --my-post-name-color: #{dark-light-diff(#1e79a7, $secondary, 0%, 25%)};
}
$my-background: #ABDAFB;
$my-border: #38abe3;

:root {
    --my-quote-background: #{dark-light-choose($my-background, $primary-low)};
    --my-quote-border: #{dark-light-choose($my-border, blend-primary-secondary(5%))};
}

When I try to use the colors I define, the browser only reports that they are unknown and everything is broken.

One usage is like this:

aside.quote .title  {
    background-color: var(--my-quote-background);
    border-left: 5px solid var(--my-quote-border);
}

aside.quote blockquote {
    background-color: var(--my-quote-background);
    border-left: 5px solid var(--my-quote-border);
} 

What am I doing wrong?

The only non-default colors I can see are from the BBCode plugin.

2 Likes

Upon further investigation I found that theme component color definitions changes do not propagate into a theme. They can be made to propagate (once) by changing the theme’s own color definitions.

Adding or removing theme components also does not update the effective color definitions.

Looks like a bug?

3 Likes

Yes, confirmed, it is a bug, sorry about that, will fix it shortly.

5 Likes

FIX: Update digest when updating color definitions in theme component… · discourse/discourse@bfa3e24 · GitHub should fix this.

4 Likes