Skip to main content
Tim_Clulow
November 14, 2023

SVG-Export: add feature to export local variable names into svg code with static-color fallback

  • November 14, 2023
  • 13 replies
  • 1934 views

When working with SVG assets within a design system we’re often using named color variables that are part of the design system so that our designs support different color modes (light, dark etc)

it would be super helpful if there was some way for these variables made their way into the SVG code (with a fallback for situations or usages where the variable may not exist)

So in your SVG export instead of this:

<rect x="0.331604" y="0.717941" width="20.9977" height="20.9977" fill="#ffffff"/>

you’d get something like this

<rect x="0.331604" y="0.717941" width="20.9977" height="20.9977" fill="var(--color-background, #ffffff)"/>

which would then be able to be able to be dynamically changed based on what is being set for --color-background in the consuming web app.

13 replies

Michael_Gehrmann
New Member
December 17, 2024

Oh Wow, @Avner_H !
This ist amazing. You brighten up my Christmas Mood!

Tiziano
Active Member
May 16, 2025

This should be supported natively!
Please implement this Figma… We need this urgently to batch export to our Design System Documentation. No Plugin can properly do this...

Avner_H
New Member
July 1, 2025

Hey there, your feedbacks made me work on a second similar plugin, mainly for bulk export.

The new plugin Bulk Export SVGs with tokens is available for design mode (not dev mode), it allows you to select multiple elements to export as SVG into a single zip (or select only one to export as SVG). It works with a better hex->token matching algorithm. It supports only hex color profile currently. Will work on adding support for display p3 too soon.

Any feedback appreciated (please use comments section on the plugin page)

@Tiziano I hope it will help you achieve what you need