Skip to content

Commit 79db9b1

Browse files
authored
feat: Proper dark mode (#8274)
* Push * Update svelte REPL * Light mode fixes * Fox height issues * Moar dark mode fixes * More changes * Fix zen mode height issue
1 parent f4c593f commit 79db9b1

File tree

16 files changed

+170
-150
lines changed

16 files changed

+170
-150
lines changed

sites/svelte.dev/package-lock.json

Lines changed: 45 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sites/svelte.dev/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"dependencies": {
1919
"@supabase/supabase-js": "^2.7.1",
20-
"@sveltejs/repl": "0.0.3",
20+
"@sveltejs/repl": "^0.1.2",
2121
"cookie": "^0.5.0",
2222
"devalue": "^4.2.3",
2323
"do-not-zip": "^1.0.0",

sites/svelte.dev/src/config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// REPL props
22

33
export const svelteUrl = `https://unpkg.com/svelte@3`;
4-
export const rollupUrl = `https://unpkg.com/rollup@1/dist/rollup.browser.js`;
54
export const mapbox_setup = `window.MAPBOX_ACCESS_TOKEN = '${
65
import.meta.env.VITE_MAPBOX_ACCESS_TOKEN
76
}';`;

sites/svelte.dev/src/routes/(authed)/repl/[id]/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
4242
afterNavigate(() => {
4343
repl.set({
44-
components: data.gist.components
44+
components: data.gist.components,
4545
});
4646
});
4747

sites/svelte.dev/src/routes/(authed)/repl/[id]/AppControls.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ export default app;`,
243243
align-items: center;
244244
justify-content: space-between;
245245
padding: 0.6rem var(--side-nav);
246-
background-color: var(--second);
247-
color: white;
246+
background-color: var(--sk-back-4);
247+
color: var(--sk-text-1);
248248
white-space: nowrap;
249249
flex: 0;
250250
}
@@ -256,9 +256,9 @@ export default app;`,
256256
padding: 0.2em;
257257
opacity: 0.7;
258258
transition: opacity 0.3s;
259-
font-family: var(--font);
259+
font-family: var(--sk-font);
260260
font-size: 1.6rem;
261-
color: white;
261+
color: var(--sk-text-1);
262262
/* width: 1.6em;
263263
height: 1.6em; */
264264
line-height: 1;
@@ -280,7 +280,7 @@ export default app;`,
280280
background: transparent;
281281
border: none;
282282
color: currentColor;
283-
font-family: var(--font);
283+
font-family: var(--sk-font);
284284
font-size: 1.6rem;
285285
opacity: 0.7;
286286
outline: none;

sites/svelte.dev/src/routes/+layout.svelte

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
</main>
5353

5454
<style>
55+
:global(:root) {
56+
color-scheme: light dark;
57+
}
58+
5559
@media (max-width: 830px) {
5660
:global(aside) {
5761
z-index: 9999 !important;
@@ -84,26 +88,22 @@
8488
}
8589
}
8690
87-
/** Ukraine banner */
88-
:root {
89-
--ukr-footer-height: 48px;
91+
:global(html, body) {
92+
height: 100%;
93+
width: 100%;
9094
}
9195
92-
main {
93-
padding-bottom: var(--ukr-footer-height);
94-
}
95-
96-
:global(.examples-container, .repl-outer, .tutorial-outer) {
96+
/* :global(.examples-container, .repl-outer, .tutorial-outer) {
9797
height: calc(100vh - var(--nav-h) - var(--ukr-footer-height)) !important;
98-
}
98+
} */
9999
100100
:global(.toggle) {
101101
bottom: var(--ukr-footer-height) !important;
102102
}
103103
104-
:global(.zen-mode) {
104+
/* :global(.zen-mode) {
105105
height: calc(100vh - var(--ukr-footer-height)) !important;
106-
}
106+
} */
107107
108108
@media (max-width: 830px) {
109109
:global(aside) {

sites/svelte.dev/src/routes/_components/Demo.svelte

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
{
1818
id: 'reactive-assignments',
1919
title: 'Reactivity',
20-
description: 'Trigger efficient, granular updates by assigning to local variables. The compiler does the rest.',
20+
description:
21+
'Trigger efficient, granular updates by assigning to local variables. The compiler does the rest.',
2122
},
2223
{
2324
id: 'svg-transitions',
2425
title: 'Transitions',
25-
description: 'Build beautiful UIs with a powerful, performant transition engine built right into the framework.',
26+
description:
27+
'Build beautiful UIs with a powerful, performant transition engine built right into the framework.',
2628
},
2729
];
2830
@@ -102,8 +104,8 @@
102104
}
103105
104106
button.selected {
105-
background-color: white;
106-
color: var(--sk-back-1);
107+
background-color: var(--sk-back-1);
108+
color: var(--sk-text-2);
107109
}
108110
109111
.small-show {

sites/svelte.dev/src/routes/_components/Section.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<style>
66
section {
77
padding: 10rem 0;
8-
background: var(--background, white);
8+
background: var(--background, var(--sk-back-2));
99
}
1010
1111
.inner {

sites/svelte.dev/src/routes/_components/Supporters/index.svelte

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
import donors from './donors.js';
55
</script>
66

7-
<Section
8-
--background="radial-gradient(circle at top right, rgb(230, 233, 236), rgb(244, 245, 247))"
9-
>
7+
<Section>
108
<p class="intro">
119
Svelte is free and open source software, made possible by the work of hundreds of supporters.
1210
</p>
@@ -50,7 +48,7 @@
5048

5149
<style>
5250
h3 {
53-
color: var(--text);
51+
color: var(--sk-text-2);
5452
}
5553
5654
.intro {
@@ -112,7 +110,7 @@
112110
}
113111
114112
.intro {
115-
font-size: var(--h3);
113+
font-size: var(--sk-text-m);
116114
}
117115
118116
h3 {

sites/svelte.dev/src/routes/_components/WhosUsingSvelte/index.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
align-items: center;
3636
justify-content: center;
3737
padding: 0;
38-
color: var(--text);
38+
color: var(--sk-text-2);
3939
filter: grayscale(1) contrast(4) opacity(0.4) invert(var(--invert, 0));
4040
grid-column: span 2;
4141
}
@@ -73,4 +73,11 @@
7373
--row-size: 5;
7474
}
7575
}
76+
77+
@media (prefers-color-scheme: dark) {
78+
a {
79+
--invert: 1;
80+
filter: grayscale(1) contrast(4) opacity(0.7) invert(var(--invert, 0));
81+
}
82+
}
7683
</style>

0 commit comments

Comments
 (0)