WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10k stars 4.02k forks source link

Color style variations don't resolve CSS custom properties #62245

Open fabiankaegy opened 1 month ago

fabiankaegy commented 1 month ago

When defining a color palette in theme.json it is possible to reference external colors by using CSS custom properties as follows:

{
    "settings": {
        "custom": {
            "color": {
                "foo": "#39ab00"
            }
        },
        "color": {
            "palette": [
                {
                    "slug": "foo",
                    "name": "Foo",
                    "color": "var(--wp--custom--color--foo)"
                }
            ]
        }
    }
}

Doing this will resolve the colors correctly everywhere in the UI. However, this is not the case in the new design of style variations, which showcases the different color palettes defined in block theme style variations. There, they appear in greyscale.

CleanShot 2024-06-03 at 17 34 53@2x

fabiankaegy commented 1 month ago

CC: @richtabor as I know you worked on this