Windows Outlook prefers-color-scheme

Copper Contributor

I've been using the snippet below to show/hide images if a client prefers dark-mode over default light-mode. Its been working great ever since I've put in place but recently it does not work for OL Office on any Windows (365 Windows 10, Mail Windows 11, Mail Windows 11).
It works as intended on OL Office Mac or OL Office Web app.

Is prefers-color-scheme still supported ?



Windows 10 Pro

Version 22H2

OS build 19045.3324

Windows Feature Experience Pack 1000.19041.1000.0


<!--Dark Mode image swap code. Works in Apple/iOS. Works on, but only if the images are linked-->
    .dark-img { display: none !important; }

    @media (prefers-color-scheme:dark) {
      .dark-img {
        display: block !important;

      .light-img {
        display: none !important;

    [data-ogsc] .dark-img {
      display: block !important;

    [data-ogsc] .light-img {
      display: none !important;

  <a href=""><img class="light-img" src="" width="300" height="300" alt="" style="width: 100%; max-width: 300px; height: auto;" border="0" />
  <!--[if !mso]><! -->
  <img class="dark-img" src="" width="200" height="200" alt="" style="width: 100%; max-width: 200px; height: auto;" border="0" />


1 Reply


The prefers-color-scheme media query is primarily intended for use in web browsers and web-based email clients that support it. It allows websites to adapt their appearance based on the user's preferred color scheme (dark or light mode) in the operating system or browser.

However, support for prefers-color-scheme in desktop email clients, including Windows Outlook, is limited or non-existent. Most desktop email clients do not provide this level of CSS media query support, which means that your email's dark mode image swap code is unlikely to work as expected in these clients.

In your case, it appears that your code works in Apple/iOS clients and because they might support some web-related CSS features. However, for Windows Outlook and other desktop email clients, this feature is not reliable.

To ensure a consistent user experience across all email clients, including desktop ones, it's best to rely on more basic CSS and HTML techniques for image display and layout. This might involve sending both light and dark versions of images in your email and using regular CSS properties like display and visibility to control their visibility, rather than relying on advanced media queries.

Email client support for advanced CSS features can be inconsistent, so it's often recommended to design HTML emails with simplicity and compatibility in mind.

My knowledge of this topic is limited, but since no one has answered it for at least one day or more, I entered your question in various AI. The text and the steps are the result of various AI's put together.


My answers are voluntary and without guarantee!


Hope this will help you.

Was the answer useful? Mark them as helpful!

This will help all forum participants.