0

I wanted to check if I could use something like the CSS var() function with the GeoServer CSS plugin styles.
Something to look like:

    :root {
        --land-color: #f2efe9;
      }
    /* @title Land */
    [featurecla = 'Land'] {
        background-color: var(land-color);
      }

Except obviously for more than one variable.
I came across GeoServer CSS Styling variable but could not get the only suggested solution there to work.

This is what I tried:

/* &env=land-color:#dd0000 */
/* @title Land */
[featurecla = 'Land'] {
fill: env('land-color');
stroke: #f2efe9;
}

The result I want to get is setting a color (or any other style variable, like halo-radius or font-size) once and the use it by name in entire stylesheet, making it easier to edit it across the document.

I keep getting a default white polygon with black stroke when using this. The CSS validates properly but does nothing.

0

1 Answer 1

0

GeoServer CSS does not support the var function, or setting variables at the beginning of the stylesheet.

To add such support you could follow the guide at https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-fixes,-improvements-and-new-features-in-GeoServer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.