0

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
  • 108,386
  • 14
  • 159
  • 186
Peter
  • 9
  • 3

1 Answers1

0

This has already been asked here:

if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
    // dark mode
}
TKret96
  • 426
  • 4
  • 14
  • 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