mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-18 05:41:31 +00:00
Optimized the dark-mode toggle
This commit is contained in:
@@ -100,19 +100,43 @@
|
||||
|
||||
}
|
||||
|
||||
/* Light scheme prefered (= dark scheme not prefered)
|
||||
* -> dark scheme triggered with <html class="dark-mode">
|
||||
*/
|
||||
html.dark-mode {
|
||||
@include dark-scheme;
|
||||
|
||||
@mixin light-mode-invisible {
|
||||
*[light-mode-invisible] {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin dark-mode-invisible {
|
||||
*[dark-mode-invisible] {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
|
||||
html:not([mode]), html[mode=light] {
|
||||
@include light-mode-invisible;
|
||||
}
|
||||
|
||||
html[mode=dark] {
|
||||
@include dark-scheme;
|
||||
@include dark-mode-invisible;
|
||||
}
|
||||
|
||||
} // light prefers
|
||||
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
/* Dark scheme prefered
|
||||
* -> light scheme triggered with <html class="light-mode">
|
||||
*/
|
||||
html:not(.light-mode) {
|
||||
|
||||
html:not([mode]), html[mode=dark] {
|
||||
@include dark-scheme;
|
||||
@include dark-mode-invisible;
|
||||
}
|
||||
}
|
||||
|
||||
html[mode=light] {
|
||||
@include light-mode-invisible;
|
||||
}
|
||||
|
||||
} // dark prefers
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
@mixin dark-sheme {
|
||||
@mixin dark-scheme {
|
||||
/* syntax highlight colors from https://raw.githubusercontent.com/jwarby/pygments-css/master/monokai.css */
|
||||
--highlight-pre-bg: #272822;
|
||||
--highlight-hll-bg: #272822;
|
||||
@@ -86,13 +86,13 @@
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
html:not(.light-mode) { /* could be html.dark-mode */
|
||||
@include dark-sheme;
|
||||
html:not([mode]), html[mode=dark] {
|
||||
@include dark-scheme;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
html.dark-mode {
|
||||
@include dark-sheme;
|
||||
html[mode=dark] {
|
||||
@include dark-scheme;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,13 +182,13 @@ div.language-terminal.highlighter-rouge td.rouge-code {
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
html:not(.dark-mode) {
|
||||
html:not([mode=dark]) {
|
||||
@include light-syntax-base;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
html.light-mode {
|
||||
html[mode=light] {
|
||||
@include light-syntax-base;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user