New Tool Radar

AI Design Workflows

How to Check an AI-Generated Image Does Not Invert Badly in Dark Mode

Preview an AI-generated image under a dark theme and check that a forced inversion does not turn it into a negative.

Schematic with three steps: View the image with a dark theme; Check the page CSS for dark-mode handling; Fix the image or the CSS before.

Some browsers and operating systems invert images when a dark theme is applied, and a light-background AI image can turn into a photographic negative. MDN documents the prefers-color-scheme media feature, which lets a page detect a dark or light preference, and the color-scheme property, which opts a page into light, dark, or both; it also notes that color-scheme: only light prevents automatic dark theme overrides. Check the image under a dark theme before publishing, and make sure the page does not let the image be inverted.

What you need

  • The AI-generated image as it will be used on the page
  • A device or browser with a dark theme enabled
  • The page CSS, if you control it

Step 1: View the image with a dark theme on

Open the page or the image in a browser with the operating system dark theme enabled, and look at the image as the reader will see it. Note any image that turns into a negative or gains a dark halo.

Step 2: Check the page CSS for dark-mode handling

Confirm the page sets color-scheme to light dark or only light as appropriate, and that images are not caught by a global invert filter. A page that opts into dark mode without protecting its images can invert them.

Step 3: Fix the image or the CSS before publishing

If the image inverts, either set the page to only light for the image area, or give the image a dark-friendly background. Re-check with the dark theme on after the fix.

Worked example: synthetic dark-mode check of one image

The table below is a synthetic example. It shows the expected result of checking one hero image under a dark theme; no page was changed.

Image area Light mode Dark mode Verdict
Hero photo Normal Normal Pass
Logo on white Normal Inverted to negative Fail
Icon set Normal Normal Pass
Illustration Normal Dark halo Fail

Expected result (UNTESTED). the hero photo and icon set pass in dark mode, and the logo and illustration fail, so the page CSS must protect those images before publishing. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • A browser dark theme is not the same as a site dark theme, so check both where the site has its own toggle.
  • A global invert filter can also invert text and icons, so fix the CSS rather than patching one image.
  • An image with a transparent background is safer than one with a baked-in white background, but it still needs a dark-mode check.
  • Operating system settings vary, so test on the devices your readers actually use.

Sources

See all