Skip to content

Commit

Permalink
Split rustdoc css to modify it more easily
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Dec 4, 2015
1 parent 68c15be commit 91cd93d
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 65 deletions.
1 change: 1 addition & 0 deletions src/librustdoc/html/layout.rs
Expand Up @@ -47,6 +47,7 @@ r##"<!DOCTYPE html>
<title>{title}</title>
<link rel="stylesheet" type="text/css" href="{root_path}rustdoc.css">
<link rel="stylesheet" type="text/css" href="{root_path}main.css">
{favicon}
Expand Down
4 changes: 3 additions & 1 deletion src/librustdoc/html/render.rs
Expand Up @@ -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"),
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/static/COPYRIGHT.txt
Expand Up @@ -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
Expand Down
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -131,15 +129,13 @@ code, pre {
white-space: pre-wrap;
}
.docblock code {
background-color: #F5F5F5;
border-radius: 3px;
padding: 0 0.2em;
}
.docblock pre code {
padding: 0;
}
pre {
background-color: #F5F5F5;
padding: 14px;
}

Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -218,10 +212,6 @@ nav.sub {
transition: border 500ms ease-out;
}

.block a:hover {
background: #F5F5F5;
}

.content {
padding: 15px 0;
}
Expand All @@ -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;
Expand All @@ -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; }
Expand Down Expand Up @@ -312,24 +285,23 @@ 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%;
}

.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 {
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand All @@ -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 {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -546,7 +502,6 @@ td.summary-column {
padding-right: 0px;
}

:target { background: #FDFFD3; }
.line-numbers :target { background-color: transparent; }

/* Code highlighting */
Expand All @@ -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; }

Expand All @@ -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%;
Expand Down
125 changes: 125 additions & 0 deletions 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 <LICENSE-APACHE or
* http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
* <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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; }

0 comments on commit 91cd93d

Please sign in to comment.