Rename main theme into light theme

This commit is contained in:
Guillaume Gomez 2018-03-28 11:18:45 +02:00
parent 14ac1b5faa
commit 772a8028ff
8 changed files with 18 additions and 18 deletions

View file

@ -53,7 +53,7 @@ r##"<!DOCTYPE html>
id="mainThemeStyle">
{themes}
<link rel="stylesheet" type="text/css" href="{root_path}dark{suffix}.css">
<link rel="stylesheet" type="text/css" href="{root_path}main{suffix}.css" id="themeStyle">
<link rel="stylesheet" type="text/css" href="{root_path}light{suffix}.css" id="themeStyle">
<script src="{root_path}storage{suffix}.js"></script>
{css_extension}

View file

@ -129,8 +129,8 @@ pub struct SharedContext {
pub sort_modules_alphabetically: bool,
/// Additional themes to be added to the generated docs.
pub themes: Vec<PathBuf>,
/// Suffix to be added on resource files (if suffix is "-v2" then "main.css" becomes
/// "main-v2.css").
/// Suffix to be added on resource files (if suffix is "-v2" then "light.css" becomes
/// "light-v2.css").
pub resource_suffix: String,
}
@ -743,7 +743,7 @@ fn write_shared(cx: &Context,
write(cx.dst.join(&format!("rustdoc{}.css", cx.shared.resource_suffix)),
include_bytes!("static/rustdoc.css"))?;
// To avoid "main.css" to be overwritten, we'll first run over the received themes and only
// To avoid "light.css" to be overwritten, we'll first run over the received themes and only
// then we'll run over the "official" styles.
let mut themes: HashSet<String> = HashSet::new();
@ -761,9 +761,9 @@ fn write_shared(cx: &Context,
write(cx.dst.join(&format!("brush{}.svg", cx.shared.resource_suffix)),
include_bytes!("static/brush.svg"))?;
write(cx.dst.join(&format!("main{}.css", cx.shared.resource_suffix)),
include_bytes!("static/themes/main.css"))?;
themes.insert("main".to_owned());
write(cx.dst.join(&format!("light{}.css", cx.shared.resource_suffix)),
include_bytes!("static/themes/light.css"))?;
themes.insert("light".to_owned());
write(cx.dst.join(&format!("dark{}.css", cx.shared.resource_suffix)),
include_bytes!("static/themes/dark.css"))?;
themes.insert("dark".to_owned());

View file

@ -67,4 +67,4 @@ function switchTheme(styleElem, mainStyleElem, newTheme) {
}
}
switchTheme(currentTheme, mainTheme, getCurrentValue('rustdoc-theme') || 'main');
switchTheme(currentTheme, mainTheme, getCurrentValue('rustdoc-theme') || 'light');

View file

@ -266,8 +266,8 @@ pub fn opts() -> Vec<RustcOptGroup> {
unstable("resource-suffix", |o| {
o.optopt("",
"resource-suffix",
"suffix to add to CSS and JavaScript files, e.g. \"main.css\" will become \
\"main-suffix.css\"",
"suffix to add to CSS and JavaScript files, e.g. \"light.css\" will become \
\"light-suffix.css\"",
"PATH")
}),
]
@ -321,7 +321,7 @@ pub fn main_args(args: &[String]) -> isize {
let to_check = matches.opt_strs("theme-checker");
if !to_check.is_empty() {
let paths = theme::load_css_paths(include_bytes!("html/static/themes/main.css"));
let paths = theme::load_css_paths(include_bytes!("html/static/themes/light.css"));
let mut errors = 0;
println!("rustdoc: [theme-checker] Starting tests!");
@ -392,7 +392,7 @@ pub fn main_args(args: &[String]) -> isize {
let mut themes = Vec::new();
if matches.opt_present("themes") {
let paths = theme::load_css_paths(include_bytes!("html/static/themes/main.css"));
let paths = theme::load_css_paths(include_bytes!("html/static/themes/light.css"));
for (theme_file, theme_s) in matches.opt_strs("themes")
.iter()