From 91cd93d2b13c20816c8847ff56806e91172e96ba Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 4 Dec 2015 01:54:59 +0100 Subject: [PATCH] Split rustdoc css to modify it more easily --- src/librustdoc/html/layout.rs | 1 + src/librustdoc/html/render.rs | 4 +- src/librustdoc/html/static/COPYRIGHT.txt | 2 +- .../html/static/{main.css => rustdoc.css} | 77 ++--------- src/librustdoc/html/static/styles/main.css | 125 ++++++++++++++++++ 5 files changed, 144 insertions(+), 65 deletions(-) rename src/librustdoc/html/static/{main.css => rustdoc.css} (85%) create mode 100644 src/librustdoc/html/static/styles/main.css diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index faddfa4569ef4..227981d68fbb4 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -47,6 +47,7 @@ r##" {title} + {favicon} diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 574b9b599f5f8..51b49e2abd405 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -602,8 +602,10 @@ fn write_shared(cx: &Context, include_bytes!("static/main.js"))); try!(write(cx.dst.join("playpen.js"), include_bytes!("static/playpen.js"))); + try!(write(cx.dst.join("rustdoc.css"), + include_bytes!("static/rustdoc.css"))); try!(write(cx.dst.join("main.css"), - include_bytes!("static/main.css"))); + include_bytes!("static/styles/main.css"))); try!(write(cx.dst.join("normalize.css"), include_bytes!("static/normalize.css"))); try!(write(cx.dst.join("FiraSans-Regular.woff"), diff --git a/src/librustdoc/html/static/COPYRIGHT.txt b/src/librustdoc/html/static/COPYRIGHT.txt index 2e430789efcb3..8773ce6bee9f8 100644 --- a/src/librustdoc/html/static/COPYRIGHT.txt +++ b/src/librustdoc/html/static/COPYRIGHT.txt @@ -32,7 +32,7 @@ included, and carry their own copyright notices and license terms: Copyright 2005, 2015 jQuery Foundation, Inc. Licensed under the MIT license (see LICENSE-MIT.txt). -* main.css, main.js, and playpen.js: +* rustdoc.css, main.js, and playpen.js: Copyright 2015 The Rust Developers. Licensed under the Apache License, Version 2.0 (see LICENSE-APACHE.txt) or diff --git a/src/librustdoc/html/static/main.css b/src/librustdoc/html/static/rustdoc.css similarity index 85% rename from src/librustdoc/html/static/main.css rename to src/librustdoc/html/static/rustdoc.css index a90bf17601fee..9b1db51bba50f 100644 --- a/src/librustdoc/html/static/main.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -70,7 +70,6 @@ /* General structure and fonts */ body { - color: #333; font: 16px/1.4 "Source Serif Pro", Georgia, Times, "Times New Roman", serif; margin: 0; position: relative; @@ -91,17 +90,16 @@ h3 { font-size: 1.3em; } h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) { - color: black; font-weight: 500; margin: 20px 0 15px 0; padding-bottom: 6px; } h1.fqn { - border-bottom: 1px dashed #D5D5D5; + border-bottom: 1px dashed; margin-top: 0; } h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) { - border-bottom: 1px solid #DDDDDD; + border-bottom: 1px solid; } h3.impl, h3.method, h4.method, h3.type, h4.type { font-weight: 600; @@ -131,7 +129,6 @@ code, pre { white-space: pre-wrap; } .docblock code { - background-color: #F5F5F5; border-radius: 3px; padding: 0 0.2em; } @@ -139,7 +136,6 @@ code, pre { padding: 0; } pre { - background-color: #F5F5F5; padding: 14px; } @@ -185,9 +181,7 @@ nav.sub { .sidebar .location { font-size: 17px; margin: 30px 0 20px 0; - background: #e1e1e1; text-align: center; - color: #333; } .location a:first-child { font-weight: 500; } @@ -218,10 +212,6 @@ nav.sub { transition: border 500ms ease-out; } -.block a:hover { - background: #F5F5F5; -} - .content { padding: 15px 0; } @@ -241,24 +231,7 @@ nav.sub { -ms-user-select: none; user-select: none; } -.line-numbers span { color: #c67e2d; cursor: pointer; } -.line-numbers .line-highlighted { - background-color: #f6fdb0 !important; -} - -.content .highlighted { - color: #000 !important; - background-color: #ccc; -} -.content .highlighted a, .content .highlighted span { color: #000 !important; } -.content .highlighted.trait { background-color: #fece7e; } -.content .highlighted.mod { background-color: #afc6e4; } -.content .highlighted.enum { background-color: #b4d1b9; } -.content .highlighted.struct { background-color: #e7b1a0; } -.content .highlighted.fn { background-color: #c6afb3; } -.content .highlighted.method { background-color: #c6afb3; } -.content .highlighted.tymethod { background-color: #c6afb3; } -.content .highlighted.type { background-color: #c6afb3; } +.line-numbers span { cursor: pointer; } .docblock.short p { display: inline; @@ -279,7 +252,7 @@ nav.sub { .docblock.short code { white-space: nowrap; } .docblock h1, .docblock h2, .docblock h3, .docblock h4, .docblock h5 { - border-bottom: 1px solid #DDD; + border-bottom: 1px solid; } .docblock h1 { font-size: 1.3em; } @@ -312,7 +285,7 @@ nav.sub { .content td h1, .content td h2 { margin-left: 0; font-size: 1.1em; } .docblock table { - border: 1px solid #ddd; + border: 1px solid; margin: .5em 0; border-collapse: collapse; width: 100%; @@ -320,16 +293,15 @@ nav.sub { .docblock table td { padding: .5em; - border-top: 1px dashed #ddd; - border-bottom: 1px dashed #ddd; - + border-top: 1px dashed; + border-bottom: 1px dashed; } .docblock table th { padding: .5em; text-align: left; - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; + border-top: 1px solid; + border-bottom: 1px solid; } .content .item-list { @@ -368,11 +340,11 @@ nav.sub { } .content .stability code { - font-size: 90%; + font-size: 90%; } nav { - border-bottom: 1px solid #e0e0e0; + border-bottom: 1px solid; padding-bottom: 10px; margin-bottom: 10px; } @@ -381,11 +353,11 @@ nav.main { text-align: center; } nav.main .current { - border-top: 1px solid #000; - border-bottom: 1px solid #000; + border-top: 1px solid; + border-bottom: 1px solid; } nav.main .separator { - border: 1px solid #000; + border: 1px solid; display: inline-block; height: 23px; margin: 0 20px; @@ -399,29 +371,17 @@ nav.sub, .content { a { text-decoration: none; - color: #000; background: transparent; } -.docblock a, .stability a { - color: #4e8bca; -} - .docblock a:hover, .stability a { text-decoration: underline; } -.content span.trait, .content a.trait, .block a.current.trait { color: #8866ff; } -.content span.mod, .content a.mod, block a.current.mod { color: #4d76ae; } .content span.enum, .content a.enum, .block a.current.enum { color: #5e9766; } .content span.struct, .content a.struct, .block a.current.struct { color: #e53700; } -.content a.primitive { color: #39a7bf; } .content a.type { color: #e57300; } .content a.macro { color: #068000; } -.content span.fn, .content a.fn, .block a.current.fn, -.content span.method, .content a.method, .block a.current.method, -.content span.tymethod, .content a.tymethod, .block a.current.tymethod, -.content .fnname { color: #8c6067; } .block a.current.crate { font-weight: 500; } .search-input { @@ -434,11 +394,9 @@ a { outline: none; border: none; border-radius: 1px; - color: #555; margin-top: 5px; padding: 10px 16px; font-size: 17px; - box-shadow: 0 0 0 1px #e0e0e0, 0 0 0 2px transparent; transition: border-color 300ms ease; transition: border-radius 300ms ease-in-out; transition: box-shadow 300ms ease-in-out; @@ -512,8 +470,6 @@ body.blur > :not(#help) { padding: 20px; } -em.stab.unstable { background: #FFF5D6; border-color: #FFC600; } -em.stab.deprecated { background: #F3DFFF; border-color: #7F0087; } em.stab { display: inline-block; border-width: 1px; @@ -546,7 +502,6 @@ td.summary-column { padding-right: 0px; } -:target { background: #FDFFD3; } .line-numbers :target { background-color: transparent; } /* Code highlighting */ @@ -555,8 +510,6 @@ pre.rust .kw-2, pre.rust .prelude-ty { color: #4271AE; } pre.rust .number, pre.rust .string { color: #718C00; } pre.rust .self, pre.rust .boolval, pre.rust .prelude-val, pre.rust .attribute, pre.rust .attribute .ident { color: #C82829; } -pre.rust .comment { color: #8E908C; } -pre.rust .doccomment { color: #4D4D4C; } pre.rust .macro, pre.rust .macro-nonterminal { color: #3E999F; } pre.rust .lifetime { color: #B76514; } @@ -565,9 +518,7 @@ pre.rust { position: relative; } a.test-arrow { display: inline-block; position: absolute; - background-color: #4e8bca; - color: #f5f5f5; padding: 5px 10px 5px 10px; border-radius: 5px; font-size: 130%; diff --git a/src/librustdoc/html/static/styles/main.css b/src/librustdoc/html/static/styles/main.css new file mode 100644 index 0000000000000..e138d62f986c1 --- /dev/null +++ b/src/librustdoc/html/static/styles/main.css @@ -0,0 +1,125 @@ +/** + * Copyright 2015 The Rust Project Developers. See the COPYRIGHT + * file at the top-level directory of this distribution and at + * http://rust-lang.org/COPYRIGHT. + * + * Licensed under the Apache License, Version 2.0 or the MIT license + * , at your + * option. This file may not be copied, modified, or distributed + * except according to those terms. + */ + +/* General structure and fonts */ + +body { + background-color: white; + color: black; +} + +h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) { + color: black; +} +h1.fqn { + border-bottom-color: #D5D5D5; +} +h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod) { + border-bottom-color: #DDDDDD; +} + +.docblock code { + background-color: #F5F5F5; +} +pre { + background-color: #F5F5F5; +} + +.sidebar .location { + background: #e1e1e1; + color: #333; +} + +.block a:hover { + background: #F5F5F5; +} + +.line-numbers span { color: #c67e2d; } +.line-numbers .line-highlighted { + background-color: #f6fdb0 !important; +} + +:target { background: #FDFFD3; } +.content .highlighted { + color: #000 !important; + background-color: #ccc; +} +.content .highlighted a, .content .highlighted span { color: #000 !important; } +.content .highlighted.trait { background-color: #fece7e; } +.content .highlighted.mod { background-color: #afc6e4; } +.content .highlighted.enum { background-color: #b4d1b9; } +.content .highlighted.struct { background-color: #e7b1a0; } +.content .highlighted.fn { background-color: #c6afb3; } +.content .highlighted.method { background-color: #c6afb3; } +.content .highlighted.tymethod { background-color: #c6afb3; } +.content .highlighted.type { background-color: #c6afb3; } + +.docblock h1, .docblock h2, .docblock h3, .docblock h4, .docblock h5 { + border-bottom-color: #DDD; +} + +.docblock table { + border-color: #ddd; +} + +.docblock table td { + border-top-color: #ddd; + border-bottom-color: #ddd; +} + +.docblock table th { + border-top-color: #ddd; + border-bottom-color: #ddd; +} + +.content a.primitive { color: #39a7bf; } +.content span.mod, .content a.mod, block a.current.mod { color: #4d76ae; } +.content span.fn, .content a.fn, .block a.current.fn, +.content span.method, .content a.method, .block a.current.method, +.content span.tymethod, .content a.tymethod, .block a.current.tymethod, +.content .fnname { color: #8c6067; } + +pre.rust .comment { color: #8E908C; } +pre.rust .doccomment { color: #4D4D4C; } + +nav { + border-bottom-color: #e0e0e0; +} +nav.main .current { + border-top-color: #000; + border-bottom-color: #000; +} +nav.main .separator { + border-color: 1px solid #000; +} +a { + color: #000; +} + +.docblock a, .stability a { + color: #4e8bca; +} + +a.test-arrow { + color: #f5f5f5; +} + +.content span.trait, .content a.trait, .block a.current.trait { color: #8866ff; } + +.search-input { + color: #555; + box-shadow: 0 0 0 1px #e0e0e0, 0 0 0 2px transparent; + background-color: white; +} + +em.stab.unstable { background: #FFF5D6; border-color: #FFC600; } +em.stab.deprecated { background: #F3DFFF; border-color: #7F0087; }