Skip to content
Product and web UIguide

How to supply a dark-mode variant of an icon image

By SkeuDesign Editorial Team1 min read

Answer in brief

Put a dark-theme source in picture using prefers-color-scheme and retain the default image as the fallback. Align the selection mechanism with the way your application chooses its theme.

Inspect a translucent glass badge

Use a darker rim and a lighter reflection in the dark asset, keeping both exports the same size. Switch the system theme and inspect the selected file and the edge against its actual surface.

Test theme changes without a reload

Leave the artwork on screen while switching the system color preference. Read the selected image URL again after the switch and compare the card's actual background. An image that switched correctly can still look wrong when an application's saved theme keeps the surrounding surface in the previous palette.

Sources

  1. [1] prefers-color-scheme CSS media feature - CSS — MDN Web Docs, accessed November 23, 2026

Frequently asked questions

What if the app has its own independent theme switch?

A media query follows the environment's preference. Use application theme state to select artwork when the in-app choice differs.