Challenges creating a custom color palette

I’ve tried to create a completely custom color scheme by defining my colors in the about.json file of my theme on GitHub.

Unfortunately only some of my color definitions are being respected in the site.

For example, in my json scheme I define: "success_low": "DDE2B2”,

However my style guide shows a different (computed) color for var(--success-low)

I’ve read through all the guides and it seems maybe the json palette definitions are not all used and instead discourse is computing some of the values on its own and not respecting my definition.

Do I need to instead hard code the colors in a css variables file? Will these override the computed values? Where and how should I do this? I’d like to define every single color for both light and dark mode in discourse, I don’t like any of the computed values.

Thanks for any help. It’s been very hard to wrap my head around how all this stuff works, what takes priority in the final css, etc.

update: this post would seem to contradict my troubleshooting:

So it leaves me more confused about why discourse still seems to be auto generating colors

1 Like

i see there is an underscore in the first (success_low) and a dash in the second (success-low).

you can always paste your color palette here as it appears in the json file for us to have a look.

Thanks, I will go through and check all the underscores vs dashes. Is there any reference json file I could find somewhere that has a reference for all variables, with dashes and underscores in the right places?

I originally used the “solarized” theme as a reference

This is extremely confusing. In the styleguide the labeled css variables use dashes:

Whereas in this (and other) example schemes they have underscores:

I am admittedly not the sharpest coding knife in the drawer, and I’m sure people who’ve worked on this for a long time find it more obvious and intuitive… but trying to wade through this feels like I’m going a bit crazy.

It’s really hard to get an intuitive grasp of all the logic for how light and dark mode colors are used. Between the multitude of scss files and transformations, json, admin GUI, palettes which are (somewhat?) independent of themes…

Sorry for my rambling, just struggling a bit over here

you have another old topic that may help you with this

Unfortunately that thread didn’t solve the issue.

I’m still confused – is there no clear guidance available about how to set every color? And what the correct syntax/names are in the json vs the css variables?

did you look at this?

I’m not seeing anything obviously wrong with your about.json file so it may be something else with the way you have your theme configured. :thinking:

specifically which variables are working and which aren’t?

have you read any of the theme dev topics? i think it is possible you may be missing other required theme files in your repo.

2 Likes

Yes I’ve read them, but there’s no complete reference for all the color variables that I could see. I based my about.json file on the “solarized” theme which seemed to have all the variables declared. I’m going to try again from clean slate and report back and use developer tools to see what the issues might be…

Thanks for the help so far