Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to get mobile preferences is it dark or light using javascript

if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
    // dark mode
}

window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
    const newColorScheme = e.matches ? "dark" : "light";
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: random number from 1 to 10000 js 
Javascript :: turn gravity off on one object matter js 
Javascript :: js log without newline 
Javascript :: NO "ELSE" STATEMENT IN THIS CODE 
Javascript :: search and delete instances of node_modules in directory 
Javascript :: https://ssl.clickbank.net/order/orderform.html?time=1637595355&vvvv=62766b313233&item=6&cbfid=35141&cbf=YQYI4X5NDF&vvar=cbfid%3D35141&corid=1ee8f46f-018e-4c7d-ba0c-733317d97f43 
Javascript :: using if else how to compare value in js 
Javascript :: javascript array get element by index 
Javascript :: bookshelf log query 
Javascript :: nested array generator for js 
Javascript :: how 2 stop gif loop jsx 
Javascript :: Dublin, Edinburgh, Lisbon, London getcurrentdatetime in angularjs 
Javascript :: auto refresh database in outsystems reactive 
Javascript :: Change the content of ALL the p tags 
Javascript :: jquery autocomplete set suggestion length 
Javascript :: react navigation tabs up in keyboard 
Javascript :: javascript pdf 
Javascript :: if condition in jasper expression editor 
Javascript :: ver versao do sublime text 
Javascript :: char code to string javascript 
Javascript :: export data from paginated api javascript vuetify 
Javascript :: javascript list all declared variables 
Javascript :: Access the list of valid values for an Enum field in a MongoDb Mongoose Schema 
Javascript :: nodejs pub sub redis 
Javascript :: flow parsing package.json and showing error 
Javascript :: escape exponential input number in js 
Javascript :: clone copy a table in servicenow 
Javascript :: how to send email 
Javascript :: check version of 3rd package npm 
Javascript :: to see all function attribute and methods in javascript 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =