Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

detect browser theme

if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
  console.log('User prefers dark mode on his device');
}
Comment

detect browser theme

@media (prefers-color-scheme: dark) {
  // color variables for users which want your site to be dark
}
@media (prefers-color-scheme: light) {
  // color variables for users which want your site to be light
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery checked 
Javascript :: title case a sentence-javascript 
Javascript :: javascript if undefined 
Javascript :: fontawesome in next js 
Javascript :: array to set javascript 
Javascript :: javascript set input value by class name 
Javascript :: javascript remove last character from string 
Javascript :: detect fullscreen mode 
Javascript :: how to select data attribute in javascript 
Javascript :: javascript HOW set delay 
Javascript :: jquery serialize form data and submit 
Javascript :: react native loading 
Javascript :: jquerygrid disable sorting 
Javascript :: javascript make sound 
Javascript :: login discord token 
Javascript :: how to check if object is empty javascript 
Javascript :: max value in array javascript 
Javascript :: pyspark dataframe json string 
Javascript :: discord js user has role 
Javascript :: expressjs hello world 
Javascript :: vuejs form prevent default event 
Javascript :: how to detect the keyboard keys in js 
Javascript :: word count js 
Javascript :: how to store words in an array in javascript 
Javascript :: get number of creeps screeps 
Javascript :: javascript filesystem 
Javascript :: how to call a function with a button in javascript 
Javascript :: scrolling for chatbot 
Javascript :: integer check in javascript 
Javascript :: javascript generate random hex 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =