SimonSiefke / vscode-svg-preview

Svg Preview for VSCode
MIT License
44 stars 4 forks source link

Support css custom properties #36

Closed IanVS closed 4 years ago

IanVS commented 4 years ago

I would like to use css custom properties in my svg files, which works fine, except that the preview doesn't know what to do with them, since they're set in my app and not in the svg file itself. Is there a way to set the values in the "svgPreview.style" setting? I've tried and haven't quite found a way to make it work yet.

Thanks!

SimonSiefke commented 4 years ago

Thanks for the suggestion. You can now define CSS variables in the settings, e.g.

{
  "svgPreview.style": {
    "html": {
      "--red": "orangered"
    }
  }
}

or

{
  "svgPreview.style": {
    "img": {
      "--red": "orangered"
    }
  }
}