Skip to content

Commit fb4f4fb

Browse files
committed
fix: avoid flash of default theme
1 parent 6f4b057 commit fb4f4fb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pages/_app.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ export default function App({ Component, pageProps }) {
1919
src="https://analytics.teknologiumum.com/script.js"
2020
data-website-id="86735db8-4270-486a-8db9-b79b91aa9470"
2121
></script>
22+
<script
23+
dangerouslySetInnerHTML={{
24+
__html: `
25+
(() => {
26+
const theme = localStorage.getItem('teknologi-umum-blog-theme');
27+
if (theme === 'dark') {
28+
document.documentElement.classList.add('dark');
29+
} else {
30+
document.documentElement.classList.remove('dark');
31+
}
32+
})();
33+
`,
34+
}}
35+
></script>
2236
</Head>
2337
<Component {...pageProps} />
2438
</Layout>

0 commit comments

Comments
 (0)