Skip to content

Commit 033cf44

Browse files
Copilotcsharpfritz
andcommitted
Add critical CSS for immediate theme application
Co-authored-by: csharpfritz <[email protected]>
1 parent f21c798 commit 033cf44

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Web/Pages/Shared/_Layout.cshtml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,48 @@
3434
})();
3535
</script>
3636

37+
<!-- Critical CSS for immediate theme application -->
38+
<style>
39+
:root {
40+
/* Light theme colors */
41+
--bg-primary: #ffffff;
42+
--bg-secondary: #f8f9fa;
43+
--text-primary: #212529;
44+
--text-secondary: #6c757d;
45+
--navbar-bg: #ffffff;
46+
--navbar-text: #212529;
47+
}
48+
49+
/* Dark theme colors */
50+
html[data-theme="dark"],
51+
html[data-theme-resolved="dark"] {
52+
--bg-primary: #1a1a1a;
53+
--bg-secondary: #2d3748;
54+
--text-primary: #f7fafc;
55+
--text-secondary: #cbd5e0;
56+
--navbar-bg: #1a1a1a;
57+
--navbar-text: #f7fafc;
58+
}
59+
60+
/* Immediate body styling */
61+
body {
62+
background-color: var(--bg-primary);
63+
color: var(--text-primary);
64+
margin: 0;
65+
transition: background-color 0.3s ease, color 0.3s ease;
66+
}
67+
68+
/* Immediate navbar styling */
69+
.navbar {
70+
background-color: var(--navbar-bg) !important;
71+
color: var(--navbar-text) !important;
72+
}
73+
.navbar .navbar-brand,
74+
.navbar .nav-link {
75+
color: var(--navbar-text) !important;
76+
}
77+
</style>
78+
3779
<!-- Feeds and Sitemap -->
3880
<link rel="sitemap" type="application/xml" title="Sitemap" href="/sitemap.xml" />
3981
<link rel="alternate" type="application/rss+xml" title="Latest Tips" href="/feed.rss" />

0 commit comments

Comments
 (0)