about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2015-10-28 20:27:34 -0400
committerSteve Klabnik <steve@steveklabnik.com>2015-10-28 20:27:34 -0400
commit43c553a7d32190d0fbd88e8510318b63ae0028ab (patch)
tree0d0770c85e154168183953fcaeccbc6eb1af74ad
parente6ad039d2c13d5280d3f23fa9b5713949fb9ef84 (diff)
parent11c7bdd160d70b2ed92b11f0699f993a54267447 (diff)
downloadrust-43c553a7d32190d0fbd88e8510318b63ae0028ab.tar.gz
rust-43c553a7d32190d0fbd88e8510318b63ae0028ab.zip
Rollup merge of #29264 - mdinger:colorify, r=steveklabnik
This is an alternative to https://github.com/rust-lang/rust/pull/29240 which fixes #15307 by adding colors to primitives and aliases instead of underlining.

Try to keep the discussion in https://github.com/rust-lang/rust/pull/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)
-rw-r--r--src/librustdoc/html/format.rs4
-rw-r--r--src/librustdoc/html/static/main.css9
2 files changed, 8 insertions, 5 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index d12c5d2c6fb..79585a94cd0 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -378,7 +378,7 @@ fn primitive_link(f: &mut fmt::Formatter,
         Some(&LOCAL_CRATE) => {
             let len = CURRENT_LOCATION_KEY.with(|s| s.borrow().len());
             let len = if len == 0 {0} else {len - 1};
-            try!(write!(f, "<a href='{}primitive.{}.html'>",
+            try!(write!(f, "<a class='primitive' href='{}primitive.{}.html'>",
                         repeat("../").take(len).collect::<String>(),
                         prim.to_url_str()));
             needs_termination = true;
@@ -398,7 +398,7 @@ fn primitive_link(f: &mut fmt::Formatter,
             };
             match loc {
                 Some(root) => {
-                    try!(write!(f, "<a href='{}{}/primitive.{}.html'>",
+                    try!(write!(f, "<a class='primitive' href='{}{}/primitive.{}.html'>",
                                 root,
                                 path.0.first().unwrap(),
                                 prim.to_url_str()));
diff --git a/src/librustdoc/html/static/main.css b/src/librustdoc/html/static/main.css
index 5e27eab8575..a90bf17601f 100644
--- a/src/librustdoc/html/static/main.css
+++ b/src/librustdoc/html/static/main.css
@@ -415,9 +415,12 @@ a {
 .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 span.fn, .content a.fn, .block a.current.fn { color: #8c6067; }
-.content span.method, .content a.method, .block a.current.method { color: #8c6067; }
-.content span.tymethod, .content a.tymethod, .block a.current.tymethod { color: #8c6067; }
+.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; }