[FIXED] How can I detect Windows 10 light/dark mode?


I’m using Windows.UI.ViewManagement.UISettings to get system accent color but it seems this class does not have any method or property for light/dark mode. I failed to find a document for this feature, how can I detect this?

PS: I’m making a JS app which does not have access for Windows.UI.Xaml namespace.


I have found an easier solution, which should work in JavaScript apps as well, without requiring the Windows Runtime Component – the UISettings class:

var uiSettings = new Windows.UI.ViewManagement.UISettings();
var color = uiSettings.getColorValue(

The color you get is either black for dark theme or white for light theme.

The class also has very useful event ColorValuesChanged which you can use to observe theme changes at runtime.

Answered By – Martin Zikmund

Answer Checked By – Jay B. (FixeMe Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *