Skip to content

Commit 43c553a

Browse files
committed
Rollup merge of #29264 - mdinger:colorify, r=steveklabnik
This is an alternative to #29240 which fixes #15307 by adding colors to primitives and aliases instead of underlining. Try to keep the discussion in #29240 for now though so it can be kept track of. A sample rendering is [here](http://mdinger.github.io/rust_std_colored/std/index.html)
2 parents e6ad039 + 11c7bdd commit 43c553a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/librustdoc/html/format.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ fn primitive_link(f: &mut fmt::Formatter,
378378
Some(&LOCAL_CRATE) => {
379379
let len = CURRENT_LOCATION_KEY.with(|s| s.borrow().len());
380380
let len = if len == 0 {0} else {len - 1};
381-
try!(write!(f, "<a href='{}primitive.{}.html'>",
381+
try!(write!(f, "<a class='primitive' href='{}primitive.{}.html'>",
382382
repeat("../").take(len).collect::<String>(),
383383
prim.to_url_str()));
384384
needs_termination = true;
@@ -398,7 +398,7 @@ fn primitive_link(f: &mut fmt::Formatter,
398398
};
399399
match loc {
400400
Some(root) => {
401-
try!(write!(f, "<a href='{}{}/primitive.{}.html'>",
401+
try!(write!(f, "<a class='primitive' href='{}{}/primitive.{}.html'>",
402402
root,
403403
path.0.first().unwrap(),
404404
prim.to_url_str()));

src/librustdoc/html/static/main.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,12 @@ a {
415415
.content span.mod, .content a.mod, block a.current.mod { color: #4d76ae; }
416416
.content span.enum, .content a.enum, .block a.current.enum { color: #5e9766; }
417417
.content span.struct, .content a.struct, .block a.current.struct { color: #e53700; }
418-
.content span.fn, .content a.fn, .block a.current.fn { color: #8c6067; }
419-
.content span.method, .content a.method, .block a.current.method { color: #8c6067; }
420-
.content span.tymethod, .content a.tymethod, .block a.current.tymethod { color: #8c6067; }
418+
.content a.primitive { color: #39a7bf; }
419+
.content a.type { color: #e57300; }
420+
.content a.macro { color: #068000; }
421+
.content span.fn, .content a.fn, .block a.current.fn,
422+
.content span.method, .content a.method, .block a.current.method,
423+
.content span.tymethod, .content a.tymethod, .block a.current.tymethod,
421424
.content .fnname { color: #8c6067; }
422425
.block a.current.crate { font-weight: 500; }
423426

0 commit comments

Comments
 (0)