-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
31 lines (23 loc) · 982 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Color-Pref</title>
<link rel="stylesheet" href="./css/dark.css" media="(prefers-color-scheme: dark)">
<link rel="stylesheet" href="./css/light.css" media="(prefers-color-scheme: no-preference), (prefers-color-scheme: Light)">
<link rel="stylesheet" href="./css/main.css">
</head>
<body>
<div class="container">
<h1>Prefers Color Scheme: </h1>
</div>
<script>
console.log(window.matchMedia('(prefers-color-scheme)').media) //cheks if the browser has support for colors-scheme
if (window.matchMedia('(prefers-color-scheme)').media !== 'not all') { //if the browser is supported it will console.log('Yes i am supported ')
console.log('Yes i am supported')
}
</script>
</body>
</html>