-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow disabling dark mode in configuration (#420)
* Allow disabling dark mode in configuration * Set default background according to colorScheme and browser preference
- Loading branch information
Showing
6 changed files
with
33 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
assets/theme-css/dark-mode.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
/* Dark mode is now defined in pydata-sphinx-theme CSS */ | ||
/* See html[data-theme='light'] and html[data-theme='dark'] */ | ||
|
||
/* This CSS is to override the background to dark, if that is the browser preference, | ||
instead of defaulting to light mode rendering. */ | ||
/* This CSS is to avoid flickering, by setting the background to dark, if that is the browser preference. */ | ||
|
||
/* prettier-ignore-start */ | ||
|
||
/* Theme supports light and dark; check browser preference for bg color */ | ||
|
||
{{- if (eq .Site.Params.colorScheme "auto") -}} | ||
@media (prefers-color-scheme: dark) { | ||
html:not([data-theme]) { | ||
--pst-color-background: #14181e; | ||
} | ||
} | ||
{{- end -}} | ||
|
||
/* Theme supports only dark; set background dark */ | ||
{{- if (eq .Site.Params.colorScheme "dark") -}} | ||
html:not([data-theme]) { | ||
--pst-color-background: #14181e; | ||
} | ||
{{- end -}} | ||
|
||
/* prettier-ignore-end */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters