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 this question 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;
}

EDIT

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.

  • Please use the edit link to add more information to your question, we need to know what happened and what you expected to happen. – Ian Turton Jan 1 at 14:35
  • @IanTurton Thought i was clear enough, edited with explanation. – Dror Bogin Jan 1 at 14:43
  • you still don't say what happens when you try this? – Ian Turton Jan 1 at 14:44
  • I Get a default black stroked, white polygon, edited again. – Dror Bogin Jan 1 at 14:52
  • try providing a default value to see where the error might be – Ian Turton Jan 1 at 14:54
0

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

Code changes to add such support, or funding to make that happen, are both gratefully accepted.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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