DEV Community

Cover image for Edit Inline SVG Visually - and Keep Undo in VS Code
team@axialis.com
team@axialis.com

Posted on

Edit Inline SVG Visually - and Keep Undo in VS Code

An inline SVG is part of your source code, but adjusting its shape is often easier on a canvas. The awkward part is bringing the result back: copying the right block, leaving the surrounding HTML alone, and knowing what happens when you press Undo.

This walkthrough uses IconVectors to edit a static SVG from a local VS Code project. The example is deliberately small: a check-mark icon with a blue background that becomes orange. That makes the source change easy to inspect before trying more involved artwork.

Disclosure: we build IconVectors at Axialis. The screenshots below come from our recorded Windows demonstration. IconVectors is a commercial desktop application with a 30-day trial.

Start with a small, inspectable example

Download the companion HTML example.

The ZIP contains:

  • project-blue.html: the starting point.
  • project-orange.html: the reference result.
  • README.md: instructions for reproducing the workflow.

These companion files reproduce the icon geometry and colors from the recording; they are not the original recorded host file.

Here is the SVG in the blue example:

<svg xmlns="http://www.w3.org/2000/svg"
     viewBox="0 0 32 32"
     width="96"
     height="96"
     role="img"
     aria-label="Complete">
  <rect
    x="3"
    y="3"
    width="26"
    height="26"
    rx="7"
    fill="#168BEE"
  />
  <path
    d="M9 16l5 5 9-10"
    fill="none"
    stroke="#FFFFFF"
    stroke-width="3"
    stroke-linecap="round"
    stroke-linejoin="round"
  />
</svg>
Enter fullscreen mode Exit fullscreen mode

For this particular change, editing the fill value directly would also work. The purpose of using a simple color change here is to make the round trip easy to verify—not to suggest that every color edit needs a visual editor.

Open the SVG from VS Code

For the Windows workflow shown here, you need:

  • IconVectors 2.20.
  • Desktop VS Code 1.101 or later.
  • The bundled IconVectors extension.
  • A trusted local workspace.

In IconVectors, choose File → Install Visual Studio Code Extension…, select your VS Code installation, then Install / Update. Follow any reload prompt in VS Code.

Open project-blue.html. Select its complete <svg>…</svg> block, or place your cursor inside it, and run Edit Inline SVG in IconVectors.

The artwork opens in a separate IconVectors window. VS Code remains your source editor; this does not embed the drawing canvas inside it.

No AI client or MCP setup is required.

Edit visually, then save back

Select the background rectangle and change its fill from #168BEE to #F7630C.

Frame from the recording: the icon is edited in IconVectors before returning to its inline source.

Press Ctrl+S in IconVectors, then inspect the SVG in VS Code.

The accepted result updates the tracked SVG block in the editor buffer. The neighboring heading and paragraph remain outside that update.

The SVG itself may be reformatted. Compare the resulting artwork and values rather than expecting identical indentation or element serialization.

There are two saves to distinguish:

Action Result
Save in IconVectors Returns the accepted inline SVG edit to the VS Code buffer.
Save the HTML in VS Code Writes the host document to disk. VS Code Auto Save may do this if enabled.

The return happens when you save in IconVectors. It is not continuous synchronization of every drawing operation.

Undo restores the source—and pauses the link

With the imported edit as your latest change, press Ctrl+Z in VS Code. Each distinct accepted inline update is one Undo step.

The recording shows the restored source value, not a rendered browser preview.

Undo also pauses the inline association. Otherwise, a later save from the visual editor could put back the change you just rejected.

Redo restores the imported edit. Do not assume that it also resumes the association.

If updates are paused, compare the current source with the retained artwork and follow the explicit recovery or restart action.

Prefer reviewing a diff first?

Enable iconvectors.reviewInlineChanges in VS Code's User Settings.

Then use:

  1. Review Inline Result…
  2. Apply Reviewed Inline Result…

This lets you inspect the proposed change before accepting it.

Keep the scope clear

This example uses self-contained, static SVG in a local HTML file.

The following are outside this handoff:

  • Dynamic JSX/TSX expressions.
  • Framework bindings.
  • Remote or WSL workspaces.
  • Browser-based VS Code.

Also distinguish inline editing from opening a standalone .svg file.

Saving a standalone SVG changes that file on disk; those ordinary external saves are not imported as VS Code Undo steps.

The companion HTML/SVG example is provided under CC0. That permission covers the example files, not the IconVectors application or its branding.

Try the complete round trip

Start with the blue example, change its background in IconVectors, and inspect the result in VS Code. Try Undo and Redo before saving the host HTML.

The small example makes it easy to check three things:

  • Which source block changed.
  • When the host file is saved to disk.
  • What Undo restores and why it pauses the association.

Watch the 19-second recording and follow the full tutorial.

For setup and recovery details, see the VS Code integration documentation.

When you edit SVGs in a project, do you usually work with separate files or inline markup?

Top comments (0)