DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR JAVASCRIPT
javascript detect dark mode
const
isDarkMode
=
window
.
matchMedia
&&
window
.
matchMedia
(
'(prefers-color-scheme: dark)'
)
.
matches
;
Source by 1loc.dev #
PREVIOUS
NEXT
Tagged:
#javascript
#detect
#dark
#mode
ADD COMMENT
Topic
COMMENT
Name
1+1 =
Submit