-1

Can someone help me with making a JS code that return with document.write “Light” when users have light mode on and “Dark” when they have dark mode on (on their iOS device)

Paulw11
  • 102,125
  • 14
  • 152
  • 166
Peter
  • 7
  • 2

1 Answers1

0

This has already been asked here:

if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
    // dark mode
}
J.Dario
  • 321
  • 2
  • 11
  • For future reference, if a question is a duplicate you should use the "Flag" function on the question to indicate this, rather than adding an answer. – Paulw11 Jan 27 '20 at 00:45