-
Notifications
You must be signed in to change notification settings - Fork 17
fix(theme): prevent white flash during page load #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,13 +1,17 @@ | ||||||
| <footer class="Footer"> | ||||||
| <div class="Footer-border"> | ||||||
| ============================================================================================================================================================== | ||||||
| </div> | ||||||
| <div class="Footer-inner"> | ||||||
| <div class="Footer-source"> | ||||||
| <a href="https://github.com/BitDevsNBO/bitdevsnbo.org" target="_blank" rel="noopener nofollow">Source available on Github</a> | ||||||
| <body> | ||||||
| <header>...</header> | ||||||
| <main>...</main> | ||||||
| <footer class="Footer"> | ||||||
|
Comment on lines
+1
to
+4
|
||||||
| <div class="Footer-border"> | ||||||
| ============================================================================================================================================================== | ||||||
| </div> | ||||||
| <div class="Footer-rss"> | ||||||
| <a href="/feed.xml">RSS Feed</a> | ||||||
| <div class="Footer-inner"> | ||||||
| <div class="Footer-source"> | ||||||
| <a href="https://github.com/BitDevsNBO/bitdevsnbo.org" target="_blank" rel="noopener nofollow">Source available on Github</a> | ||||||
|
||||||
| <a href="https://github.com/BitDevsNBO/bitdevsnbo.org" target="_blank" rel="noopener nofollow">Source available on Github</a> | |
| <a href="https://github.com/BitDevsNBO/bitdevsnbo.org" target="_blank" rel="noopener nofollow">Source available on GitHub</a> |
Copilot
AI
Mar 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_includes/footer.html should not introduce <body>, <header>, or <main> tags; this will create invalid HTML (nested/duplicated document structure) when included inside the layout and can break styling and scripts. This include should render only the footer markup (starting at <footer class="Footer">).
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,17 @@ | ||||||||||||||||||||||||||||||||||
| <head> | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| <script> | ||||||||||||||||||||||||||||||||||
| // Immediately apply saved theme before styles load | ||||||||||||||||||||||||||||||||||
| (function() { | ||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||
| const storedTheme = localStorage.getItem('theme'); | ||||||||||||||||||||||||||||||||||
| const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; | ||||||||||||||||||||||||||||||||||
| const theme = storedTheme || (prefersDark ? 'dark' : 'light'); | ||||||||||||||||||||||||||||||||||
| document.documentElement.setAttribute('data-theme', theme); | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+9
to
+10
|
||||||||||||||||||||||||||||||||||
| const theme = storedTheme || (prefersDark ? 'dark' : 'light'); | |
| document.documentElement.setAttribute('data-theme', theme); | |
| const theme = storedTheme || (prefersDark ? 'dark' : 'light'); | |
| // Keep data-theme for compatibility, but also apply the class used by theme CSS | |
| document.documentElement.setAttribute('data-theme', theme); | |
| if (theme === 'dark') { | |
| document.documentElement.classList.add('dark-mode'); | |
| if (document.body) { | |
| document.body.classList.add('dark-mode'); | |
| } | |
| } else { | |
| document.documentElement.classList.remove('dark-mode'); | |
| if (document.body) { | |
| document.body.classList.remove('dark-mode'); | |
| } | |
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,18 +1,31 @@ | ||||||||||||||||||||||||||||||
| $background-light: #ffffff; | ||||||||||||||||||||||||||||||
| $font-light: #000000; | ||||||||||||||||||||||||||||||
| $primary-color-light: #ff7f00; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| $background-dark: #000000; | ||||||||||||||||||||||||||||||
| $font-dark: #ffffff; | ||||||||||||||||||||||||||||||
| $primary-color-dark: #ff7f00; | ||||||||||||||||||||||||||||||
| @use './variables' as vars; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| $large-screen: 1100px !default; | ||||||||||||||||||||||||||||||
| $mid-screen: 800px !default; | ||||||||||||||||||||||||||||||
| $small-screen: 480px !default; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| :root { | ||||||||||||||||||||||||||||||
| /* light theme defaults */ | ||||||||||||||||||||||||||||||
| --background-color: #ffffff; | ||||||||||||||||||||||||||||||
| --font-color: #000000; | ||||||||||||||||||||||||||||||
| --primary-color: #F7931A; | ||||||||||||||||||||||||||||||
| --link-hover-color: lighten(#F7931A, 10%); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| /* dark theme runtime overrides */ | ||||||||||||||||||||||||||||||
| body.dark-mode { | ||||||||||||||||||||||||||||||
| --background-color: #000000; | ||||||||||||||||||||||||||||||
| --font-color: #ffffff; | ||||||||||||||||||||||||||||||
| --primary-color: #F7931A; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| html, body { | ||||||||||||||||||||||||||||||
| font-family: $body-font; | ||||||||||||||||||||||||||||||
| html, | ||||||||||||||||||||||||||||||
| body { | ||||||||||||||||||||||||||||||
| font-family: vars.$body-font; | ||||||||||||||||||||||||||||||
| font-size: 16px; | ||||||||||||||||||||||||||||||
| line-height: 1.5; | ||||||||||||||||||||||||||||||
| background-color: $background-color; | ||||||||||||||||||||||||||||||
| color: $font-color; | ||||||||||||||||||||||||||||||
| background-color: var(--background-color); | ||||||||||||||||||||||||||||||
| color: var(--font-color); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| transition: background-color 0.4s ease, color 0.4s ease; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
@@ -27,41 +40,42 @@ html, body { | |||||||||||||||||||||||||||||
| @media (max-width: $small-screen) { | ||||||||||||||||||||||||||||||
| font-size: 12px; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| /* ✅ Ensures each page fills the viewport height */ | ||||||||||||||||||||||||||||||
| min-height: 100vh; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| /* Helps prevent layout shift when footer is short */ | ||||||||||||||||||||||||||||||
| display: flex; | ||||||||||||||||||||||||||||||
| flex-direction: column; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| /* ✅ Make sure the body expands correctly for content and footer */ | ||||||||||||||||||||||||||||||
| body { | ||||||||||||||||||||||||||||||
| background-color: $background-light; | ||||||||||||||||||||||||||||||
| color: $font-light; | ||||||||||||||||||||||||||||||
| background-color: var(--background-color); | ||||||||||||||||||||||||||||||
| color: var(--font-color); | ||||||||||||||||||||||||||||||
| flex: 1; /* allow content area to grow */ | ||||||||||||||||||||||||||||||
| box-sizing: border-box; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| a { | ||||||||||||||||||||||||||||||
| color: $primary-color-light; | ||||||||||||||||||||||||||||||
| color: var(--primary-color); | ||||||||||||||||||||||||||||||
| text-decoration: none; | ||||||||||||||||||||||||||||||
| transition: color 0.3s ease; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| &:hover { | ||||||||||||||||||||||||||||||
| color: lighten($primary-color-light, 10%); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| body.dark-mode { | ||||||||||||||||||||||||||||||
| background-color: $background-dark; | ||||||||||||||||||||||||||||||
| color: $font-dark; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| body.dark-mode a { | ||||||||||||||||||||||||||||||
| color: $primary-color-dark; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| &:hover { | ||||||||||||||||||||||||||||||
| color: lighten($primary-color-dark, 10%); | ||||||||||||||||||||||||||||||
| color: var(--link-hover-color, var(--primary-color)); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| /* ✅ Keeps layout centered and responsive */ | ||||||||||||||||||||||||||||||
| .Site { | ||||||||||||||||||||||||||||||
| max-width: 880px; | ||||||||||||||||||||||||||||||
| margin: 0 auto; | ||||||||||||||||||||||||||||||
| padding: 2rem; | ||||||||||||||||||||||||||||||
| background-color: var(--background-color); | ||||||||||||||||||||||||||||||
| color: var(--font-color); | ||||||||||||||||||||||||||||||
| flex: 1; /* fills remaining height between header and footer */ | ||||||||||||||||||||||||||||||
| transition: background-color 0.4s ease, color 0.4s ease; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| p { | ||||||||||||||||||||||||||||||
|
|
@@ -98,4 +112,12 @@ h4 { | |||||||||||||||||||||||||||||
| font-size: 1.2rem; | ||||||||||||||||||||||||||||||
| margin-top: 0.5rem; | ||||||||||||||||||||||||||||||
| margin-bottom: 0.5rem; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| * { | ||||||||||||||||||||||||||||||
| transition: none !important; | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| body.loaded * { | ||||||||||||||||||||||||||||||
| transition: all 0.1s ease; | ||||||||||||||||||||||||||||||
|
Comment on lines
+117
to
+122
|
||||||||||||||||||||||||||||||
| * { | |
| transition: none !important; | |
| } | |
| body.loaded * { | |
| transition: all 0.1s ease; | |
| body:not(.loaded), | |
| body:not(.loaded) * { | |
| transition: none !important; | |
| } | |
| body.loaded, | |
| body.loaded * { | |
| transition: background-color 0.1s ease, color 0.1s ease, border-color 0.1s ease; |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,12 +1,19 @@ | ||||||
| // header.scss | ||||||
|
|
||||||
| @use 'variables' as vars; | ||||||
|
||||||
| @use 'variables' as vars; | |
| @use './variables' as vars; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| .Home { | ||
| &-about { | ||
| font-size: 1.2rem; | ||
| font-weight: bold; | ||
| } | ||
|
|
||
| &-posts { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mujojo03 was this change intended to be part of this PR? Looks extraneous and accidental!