Skip to content

Commit c485aa9

Browse files
committed
fix: flash of white while loading page in dark mode
1 parent f4cf87f commit c485aa9

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

app/lib/dartdoc/dartdoc_page.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ extension DartDocPageRender on DartDocPage {
102102
name: 'viewport',
103103
content:
104104
'width=device-width, height=device-height, initial-scale=1, user-scalable=no'),
105+
d.meta(name: 'color-scheme', content: 'light dark'),
105106
d.meta(name: 'generator', content: 'made with love by dartdoc'),
106107
d.meta(name: 'description', content: description),
107108
d.element('title', text: _pageTitle(options)),

app/lib/frontend/templates/views/shared/layout.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ d.Node pageLayoutNode({
5959
name: 'viewport',
6060
content: 'width=device-width, initial-scale=1',
6161
),
62+
d.meta(name: 'color-scheme', content: 'light dark'),
6263
if (noIndex) d.meta(name: 'robots', content: 'noindex'),
6364

6465
// <!-- Twitter tags -->

pkg/web_css/lib/src/_variables.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,17 @@
156156
}
157157

158158
.light-theme {
159+
color-scheme: light;
160+
159161
.displayed-in-dark-theme {
160162
display: none !important;
161163
}
162164
}
163165

164166
/// Variables that are specific to the dark theme.
165167
.dark-theme {
168+
color-scheme: dark;
169+
166170
@include dash_variables.dark-theme;
167171

168172
--pub-color-darkBlack: #121317;

0 commit comments

Comments
 (0)