SVG guide

How to Invert an SVG for Dark Mode

By Laramie Williamson ·

A dark-mode SVG needs enough contrast against a dark surface, but full inversion is not always the best design choice. Monochrome icons, multicolor illustrations, and brand marks need different treatment.

Start with the role of the graphic

Interface icons can often follow text color with currentColor. Logos may have fixed brand colors that should not be algorithmically inverted. Decorative illustrations can tolerate broader color changes, but still need a visual review.

  • Monochrome icon: switch black paint to white or a light neutral.
  • Brand mark: use an approved dark-background variant when one exists.
  • Illustration: test all colors, gradients, and effects on the actual dark surface.

Transparency is separate from color

A transparent SVG background remains transparent when only shape colors are edited. Adding a background rectangle makes that background part of the file. That can be useful for a self-contained badge, but it is not required merely because the page is dark.

Often the real fix: remove the white, do not invert

Before reaching for inversion, check whether the problem is simply an opaque white background. If the artwork is fine but the plate behind it is not, removing the white leaves the colours untouched and lets the dark surface show through — no colour decisions required, and brand colours stay exactly as the guidelines specify. Reserve inversion for artwork whose own colours genuinely need to change.

Before
Badge artwork with a blue ring, teal tick, orange dot and red bar, drawn on a solid white square background.

Supplied with a white plate behind the mark

After
The same badge artwork with the white background and white ring fill removed, so only the coloured shapes remain over a transparent checkerboard.

Transparent PNG, 320 × 320, 11.1 KB

A small dark-mode example

This icon uses one dark fill. The dark-mode copy changes only that paint value and leaves the viewBox and path untouched.

Light and dark theme variants
<!-- Light surface -->
<path fill="#111827" d="M12 2 22 20H2Z"/>

<!-- Dark surface -->
<path fill="#f8fafc" d="M12 2 22 20H2Z"/>

Review the result in context

Preview against the same background and at the same size used in the interface. Thin strokes, low-opacity edges, and filters can look acceptable in a large editor preview but become unclear at icon size.

Apply this to your file

When you are ready to work on the asset, use FreeProTool to invert SVG colors for dark mode.

Related guides

Browse all FreeProTool guides or jump straight to the SVG tools.