Change default preferred-dark-theme to `navy`.

This commit is contained in:
Eric Huss 2020-04-21 10:18:44 -07:00
parent 484e5c0b8f
commit 23f5ffd6d6
4 changed files with 9 additions and 3 deletions

View File

@ -172,7 +172,7 @@ The following configuration options are available:
- **preferred-dark-theme:** The default dark theme. This theme will be used if - **preferred-dark-theme:** The default dark theme. This theme will be used if
the browser requests the dark version of the site via the the browser requests the dark version of the site via the
['prefers-color-scheme'](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) ['prefers-color-scheme'](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
CSS media query. Defaults to the same theme as `default-theme`. CSS media query. Defaults to `navy`.
- **curly-quotes:** Convert straight quotes to curly quotes, except for those - **curly-quotes:** Convert straight quotes to curly quotes, except for those
that occur in code blocks and code spans. Defaults to `false`. that occur in code blocks and code spans. Defaults to `false`.
- **mathjax-support:** Adds support for [MathJax](mathjax.md). Defaults to - **mathjax-support:** Adds support for [MathJax](mathjax.md). Defaults to

View File

@ -34,3 +34,9 @@ functionality. Therefore I recommend to use the file from the default theme as
template and only add / modify what you need. You can copy the default theme template and only add / modify what you need. You can copy the default theme
into your source directory automatically by using `mdbook init --theme` just into your source directory automatically by using `mdbook init --theme` just
remove the files you don't want to override. remove the files you don't want to override.
If you completely replace all built-in themes, be sure to also set
[`output.html.preferred-dark-theme`] in the config, which defaults to the
built-in `navy` theme.
[`output.html.preferred-dark-theme`]: ../config.md#html-renderer-options

View File

@ -479,7 +479,7 @@ pub struct HtmlConfig {
/// The default theme to use, defaults to 'light' /// The default theme to use, defaults to 'light'
pub default_theme: Option<String>, pub default_theme: Option<String>,
/// The theme to use if the browser requests the dark version of the site. /// The theme to use if the browser requests the dark version of the site.
/// Defaults to the same as 'default_theme' /// Defaults to 'navy'.
pub preferred_dark_theme: Option<String>, pub preferred_dark_theme: Option<String>,
/// Use "smart quotes" instead of the usual `"` character. /// Use "smart quotes" instead of the usual `"` character.
pub curly_quotes: bool, pub curly_quotes: bool,

View File

@ -511,7 +511,7 @@ fn make_data(
let preferred_dark_theme = match html_config.preferred_dark_theme { let preferred_dark_theme = match html_config.preferred_dark_theme {
Some(ref theme) => theme.to_lowercase(), Some(ref theme) => theme.to_lowercase(),
None => default_theme, None => "navy".to_string(),
}; };
data.insert( data.insert(
"preferred_dark_theme".to_owned(), "preferred_dark_theme".to_owned(),