tailpress: Can not add custom colors / text sizes to Theme.json
Hi,
There seems to be something wrong with the variables in theme.json
As you can see, the --wp–preset–font-size–2xl - 9xl are not found.
The same happens when I want to add colors to the palette. I have added a custom color to the Wordpress palette:
"palette": [
{
"name": "Primary",
"slug": "primary",
"color": "#0EA5E9"
},
{
"name": "Secondary",
"slug": "secondary",
"color": "#14B8A6"
},
{
"name": "Rood",
"slug": "rood",
"color": "#FF0000"
},
However, I can not use this in theme.css like this:
--color-primary: var(--wp--preset--color--primary);
--color-secondary: var(--wp--preset--color--secondary);
--color-rood: var(--wp--preset--color--rood);
It seems that only the standard Wordpress presets are working ( text sizes xs - xl and colors primary + secondary ) .
What am I missing here?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 15 (6 by maintainers)
I have added a note on it in the docs both with colors and fonts.
The fact that you can’t use numbers in de color names. However, this also belongs to the tailwind docs and not the tailpress docs in my opinion
@imhugos in addition to the comment of jeffreyvr:
When you define colors in theme.json, you need to define them in theme.css as well.
For instance; when you add this color in theme.json:
you should also add that color to the theme.css file like this:
--color-purple: var(--wp--preset--color--purple);This was automated in Tailpress V3 using javascript; the new way feels like a step back for me. Same goes for working with CSS layers in Tailwind V4. This is really annoying; since Wordpress and plugins are not putting their css in css layers. I’m thinking of reverting back to Tailwind V3 for this reason.