Is there a way to overwrites all colors?

AI-generated summary

A user, ahmadabdolsaheb, is seeking a way to override all colors in a Discourse theme to work with a strict color palette. awesomerobot responds that this is possible by overriding colors in the theme’s about.json file, specifically mentioning the ability to override primary and secondary colors.

ahmadabdolsaheb thanks awesomerobot for the feature and asks about compatibility with theme CLI (discourse_theme watch). They also request documentation for each color, including recommended contrast ratios.

awesomerobot provides a link to a Meta post detailing how to override auto-generated color variables in remote themes.

I am working with a strict color palette and changing the color_schemes results in undesired combinations.

I was wondering if you are aware of a theme that overwrites all colors so I could write my own color functions and modify the whole palette without replacing them one by one.

Thank you, any feedback is appreciated.

1 Like

We haven’t posted it on Meta yet (will next week) but you can override all colors in a theme in your theme’s about.json file (see the color scheme section of Developing Discourse Themes & Theme Components)

You can override $primary and other colors as mentioned in the post, but you can also override secondary colors like $primary-low, $primary-high, etc… You can see all the color variables listed here https://theme-creator.discourse.org/styleguide/atoms/colors

Note that at the moment this level of color overrides is only available in remote themes, not themes created locally in the admin ui.

10 Likes

Thanks for the great news and the feature, @awesomerobot, @david.

I just checked it out from a theme repo and it looks amazing. Would this also work with theme cli (discourse_theme watch)?

It would be great if you could include a brief usage for each color and the recommended contrast ratio from their parent variable in the upcoming post.

Are there plans for expanding all color selections to colors schemes in the admin ui anytime soon?

You can now override the colors in a remote theme, see: Override values for auto-generated color variables

4 Likes