Archived topic
Using your own variables for global colors in generatePress
3 replies · Started by Hans-Gerd on January 14, 2022
Hi,
I have defined my own variables for colors in additional CSS, e.g.
:root {
--hellgrau-color: rgba(217,217,217,1);
--grau_1-color: rgba(190,190,190,1);
--grau_2-color: rgba(204,204,204,1);
--blau-color: rgba(11,48,67,1);
--tuerkis-color: rgba(0,255,255,1);
}
However, if I want to use these variables in the Customizer at Global Colors, this is unfortunately not possible. Of course I can enter the color codes without any problems, but I would rather use the variables.
Is there a way to do this or maybe even use a theme.json in the context (I know that theme.json is used first with block themes).
I had already looked at the following post: https://generatepress.com/generatepress-3-1-global-colors-dynamic-typography/
Thanks for advice.
Best regards,
Hans-Gerd
Hi there,
you can use the generate_option_defaults filter to set default customizer options including the global_colors - see here for more info:
https://generatepress.com/forums/topic/changing-global-colors-programatically/#post-1979258
Hi David,
thank you very much for the quick reply. I will check this and get back to you if necessary.
Best regards,
Hans-Gerd
You're welcome