Skip to content

Commit

Permalink
Merge pull request #66 from ceph/bg-color
Browse files Browse the repository at this point in the history
index.html: Set background color early
  • Loading branch information
zmc authored Nov 3, 2023
2 parents e7cf15e + e68ad06 commit e8e5621
Showing 1 changed file with 40 additions and 20 deletions.
60 changes: 40 additions & 20 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Pulpito"
/>
<link rel="apple-touch-icon" href="/favicon.ico" />
<link rel="manifest" href="/manifest.json" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<title>Pulpito</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>

<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Pulpito" />
<link rel="apple-touch-icon" href="/favicon.ico" />
<link rel="manifest" href="/manifest.json" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<style>
body:where([color-scheme="dark"]) {
background-color: rgb(24, 24, 24);
}

body:where([color-scheme="light"]) {
background-color: white;
}
</style>
<title>Pulpito</title>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script>
try {
let colorScheme = "light";
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
colorScheme = "dark";
};
document.getElementsByTagName("body")[0].setAttribute("color-scheme", colorScheme);
} catch (e) {
console.error(e);
}
</script>
<script type="module" src="/src/index.tsx"></script>
</body>

</html>

0 comments on commit e8e5621

Please sign in to comment.