1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-18 14:45:32 -04:00

move light/dark class from <body> to <html> and inline restoration script to (hopefully) improve the white flashes

This commit is contained in:
2021-12-15 13:49:56 -05:00
parent c2789e24d4
commit 766362a9da
14 changed files with 61 additions and 67 deletions

View File

@@ -100,7 +100,7 @@ main {
// cool link underlines via messy SCSS hacking (see ../abstracts/_functions)
@each $theme, $map in themes.$themes {
@at-root body.#{$theme} #{&} {
@at-root html.#{$theme} #{&} {
background-image: functions.underline-hack(map.get($map, "links"), map.get($map, "background-inner"));
}
}

View File

@@ -110,23 +110,25 @@ header {
}
// Dark mode toggle
&.theme-toggle button {
border: 0;
padding: 0;
background: none;
margin: 0.3em -0.3em 0 1.4em;
cursor: pointer;
&.theme-toggle {
margin-left: 1.4em;
svg {
width: 1.56em; // 24.33px, don't ask
height: 1.56em;
button {
border: 0;
padding: 0;
background: none;
margin: 0.3em -0.3em 0 0;
cursor: pointer;
svg {
width: 1.56em; // 24.33px, don't ask
height: 1.56em;
}
}
}
// no margin on the first child to make more room on narrow windows (before responsiveness kicks in).
// last child is the dark mode toggle -- margin is set directly on it in case it's hidden (if JS is disabled).
&:first-child,
&:last-child {
// no margin on the first child to make more room on narrow windows (before responsiveness kicks in)
&:first-child {
margin-left: 0;
}
}

View File

@@ -129,7 +129,7 @@ div.highlight {
}
// Syntax Highlighting (light) - modified from Monokai Light: https://github.com/mlgill/pygments-style-monokailight
body.light {
html.light {
div.highlight,
button.copy-button,
:not(pre) > code {
@@ -215,7 +215,7 @@ body.light {
}
// Syntax Highlighting (dark) - modified from Dracula: https://github.com/dracula/pygments
body.dark {
html.dark {
div.highlight,
button.copy-button,
:not(pre) > code {