Skip to content

Commit f596632

Browse files
committed
Polish light|dark mode
1 parent adc61b5 commit f596632

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/_includes/base.njk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@
3333
<meta name="twitter:title" content="{{ title or 'Paulo Henrique Cuchi' }}">
3434
<meta name="twitter:description" content="{{ description or 'Software engineer who likes to delete code more than write it.' }}">
3535

36+
<meta name="color-scheme" content="light dark">
37+
3638
<script>
37-
(function(){var t=localStorage.getItem('theme');if(!t){t=window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light'}document.documentElement.dataset.theme=t})()
39+
(function(){var t=localStorage.getItem('theme')||'dark';document.documentElement.dataset.theme=t})()
3840
</script>
3941
</head>
4042
<body>
@@ -85,7 +87,7 @@
8587
</script>
8688

8789
<button class="theme-toggle" aria-label="Toggle dark mode" title="Toggle dark mode" onclick="var d=document.documentElement;var t=d.dataset.theme==='dark'?'light':'dark';d.dataset.theme=t;localStorage.setItem('theme',t)">
88-
<svg class="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
90+
<svg class="icon-sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="18" height="18">
8991
<circle cx="12" cy="12" r="5"/>
9092
<line x1="12" y1="1" x2="12" y2="3"/>
9193
<line x1="12" y1="21" x2="12" y2="23"/>
@@ -96,7 +98,7 @@
9698
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/>
9799
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
98100
</svg>
99-
<svg class="icon-moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
101+
<svg class="icon-moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="18" height="18">
100102
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>
101103
</svg>
102104
</button>

0 commit comments

Comments
 (0)