2

We're building an Office 365 Add-In for Outlook. Now that Outlook introduced Dark mode on Mac we wonder if there is / will be support for switching the colors/icons when outlook is running in Dark mode.

So far I wasn't able to find any information on that topic.

Christian Frommeyer
  • 1,390
  • 1
  • 12
  • 20
  • 1
    On WINDOWS there are two apis in PREVIEW. Office.context.officeTheme, and an OfficeThemeChanged event. See documentation on these here: https://learn.microsoft.com/en-us/office/dev/add-ins/reference/objectmodel/requirement-set-1.5/office.context#officetheme-object https://learn.microsoft.com/en-us/javascript/api/office/office.eventtype?view=office-js – Outlook Add-ins Team - MSFT Nov 28 '18 at 20:10
  • these will allow you to adjust your visuals inside your add-in when the theme changes, but not the icons in the ribbon. I do not have a timetable to report when these will make it to the mac version. – Outlook Add-ins Team - MSFT Nov 28 '18 at 20:11

1 Answers1

0

Most of the browser engines that run Office add-ins will allow you to detect the user's OS level preference for dark/light color scheme. See https://caniuse.com/?search=prefers-color-scheme

The big caveat is that this ignores any configuration in Office applications that override the OS level preference.

In JavaScript you can detect this with:

export const useDarkMode =
  window.matchMedia &&
  window.matchMedia("(prefers-color-scheme: dark)").matches;
markdon
  • 784
  • 8
  • 19