Skip to content

Commit 2d885f2

Browse files
committed
Default to dark mode
1 parent 4a0274d commit 2d885f2

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

www/islands/StarrySky.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default function StarrySky(props: StarrySkyProps) {
3838
r={randomRadius()}
3939
stroke="none"
4040
strokeWidth="0"
41-
fill="white"
41+
fill="hsla(var(--foreground-secondary))"
4242
key={y}
4343
className="star"
4444
/>

www/routes/_app.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ export default define.page(function App({ Component, state, url }) {
4747
// deno-lint-ignore react-no-danger
4848
dangerouslySetInnerHTML={{
4949
__html: `
50-
const isDarkMode = localStorage.theme === "dark";
50+
const isDarkMode = localStorage.theme === "dark"
51+
|| (!("theme" in localStorage)
52+
&& window.matchMedia("(prefers-color-scheme: dark)").matches);
5153
document.documentElement.dataset.theme = isDarkMode ? "dark" : "light";`,
5254
}}
5355
>

www/static/styles.css

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,6 @@
44

55
/* Light and dark theme variables */
66
:root {
7-
--background-primary: 215deg, 100%, 100%;
8-
--background-secondary: 210deg, 29%, 97%;
9-
--background-tertiary: 207deg, 33%, 95%;
10-
--foreground-primary: 0deg, 0%, 9%;
11-
--foreground-secondary: 0deg, 0%, 23%;
12-
--foreground-tertiary: 0deg, 0%, 32%;
13-
--foreground-quaternary: 0deg, 0%, 42%;
14-
15-
--info: 194deg, 76%, 41%;
16-
}
17-
html[data-theme="dark"]:root {
187
--background-primary: 217deg, 55%, 21%;
198
--background-secondary: 217deg, 55%, 25%;
209
--background-tertiary: 216deg, 27.7%, 22%;
@@ -28,6 +17,17 @@ html[data-theme="dark"]:root {
2817
color: var(--foreground-primary);
2918
background-color: var(--background-primary);
3019
}
20+
html[data-theme="light"]:root {
21+
--background-primary: 215deg, 100%, 100%;
22+
--background-secondary: 210deg, 29%, 97%;
23+
--background-tertiary: 207deg, 33%, 95%;
24+
--foreground-primary: 217deg, 55%, 21%;
25+
--foreground-secondary: 217deg, 55%, 25%;
26+
--foreground-tertiary: 0deg, 0%, 32%;
27+
--foreground-quaternary: 0deg, 0%, 42%;
28+
29+
--info: 194deg, 76%, 41%;
30+
}
3131

3232
/* Scrollbar colors that look good on light and dark theme */
3333
* {
@@ -114,10 +114,14 @@ html[data-theme="dark"] ::selection {
114114
}
115115

116116
.wish {
117-
background-color: white;
117+
background-color: hsla(var(--foreground-secondary));
118118
position: absolute;
119-
background: linear-gradient(-45deg, white, rgba(0, 0, 255, 0));
120-
filter: drop-shadow(0 0 6px white);
119+
background: linear-gradient(
120+
-45deg,
121+
hsla(var(--foreground-secondary)),
122+
rgba(0, 0, 255, 0)
123+
);
124+
filter: drop-shadow(0 0 6px hsla(var(--foreground-secondary)));
121125
overflow: hidden;
122126
}
123127

0 commit comments

Comments
 (0)