Skip to content

Commit da3a353

Browse files
MarcosNicolauOppen
andauthored
fix: dark mode toogle (#1733)
Co-authored-by: Mario Rugiero <[email protected]>
1 parent b23698b commit da3a353

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

explorer/assets/vendor/dark_mode.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ const isDark = () => {
55
.split("; ")
66
.find((row) => row.startsWith(`${themeCookieKey}=`))
77
?.split("=")[1];
8-
return (
9-
theme == "dark" ||
10-
window.matchMedia("(prefers-color-scheme: dark)").matches
11-
);
8+
return theme == "dark";
129
};
1310

1411
const setThemeCookie = (theme) => {

explorer/lib/explorer_web/components/layouts/root.html.heex

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@
3838
<meta name="csrf-token" content={get_csrf_token()} />
3939
<link phx-track-static rel="stylesheet" href={~p"/assets/app.css"} />
4040
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>
41-
if (localStorage.getItem('theme') === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
42-
document.documentElement.classList.add('dark');
43-
} else {
44-
document.documentElement.classList.remove('dark')
45-
}
4641
</script>
4742
</head>
4843
<body class="antialiased bg-gray-100 dark:bg-neutral-950">

0 commit comments

Comments
 (0)