make appearance consistent
This commit is contained in:
parent
a80789dc41
commit
6057eb7065
2 changed files with 11 additions and 0 deletions
|
@ -23,6 +23,7 @@ xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
<link href="/assets/img/favicon/favicon-32x32.png" rel="icon" type="image/png" sizes="32x32" />
|
<link href="/assets/img/favicon/favicon-32x32.png" rel="icon" type="image/png" sizes="32x32" />
|
||||||
<link href="/assets/img/favicon/apple-touch-icon.png" rel="apple-touch-icon" />
|
<link href="/assets/img/favicon/apple-touch-icon.png" rel="apple-touch-icon" />
|
||||||
<script src="https://breezy-restored.coryd.dev/script.js" data-site="RHNGSUXO">''</script>
|
<script src="https://breezy-restored.coryd.dev/script.js" data-site="RHNGSUXO">''</script>
|
||||||
|
<script src="/assets/scripts/isDarkMode.js">''</script>
|
||||||
</head>
|
</head>
|
||||||
<body class="dark:text-white dark:bg-gray-900 font-sans text-gray-800">
|
<body class="dark:text-white dark:bg-gray-900 font-sans text-gray-800">
|
||||||
<div class="min-h-screen flex flex-col">
|
<div class="min-h-screen flex flex-col">
|
||||||
|
|
10
src/assets/scripts/isDarkMode.js
Normal file
10
src/assets/scripts/isDarkMode.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
;(function () {
|
||||||
|
const isDarkMode = () =>
|
||||||
|
localStorage.theme === 'dark' ||
|
||||||
|
(!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)
|
||||||
|
if (isDarkMode()) {
|
||||||
|
document.documentElement.classList.add('dark')
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.remove('dark')
|
||||||
|
}
|
||||||
|
})()
|
Reference in a new issue