about summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-12-31 23:14:45 +0100
committerGitHub <noreply@github.com>2021-12-31 23:14:45 +0100
commit72e36d47e830a175815aba937d8a669d72d028fd (patch)
treebe3e6c93e31e3c0a1db7cc42a3475675bc9cb1bc /src/librustdoc/html/render
parent198fca8601c953b37001a2d0b712ec29d1bd735f (diff)
parent3f517fb1ae1af9f10e0e7492f725b729202499cf (diff)
downloadrust-72e36d47e830a175815aba937d8a669d72d028fd.tar.gz
rust-72e36d47e830a175815aba937d8a669d72d028fd.zip
Rollup merge of #91480 - jsha:fewer-colors, r=GuillaumeGomez
rustdoc: use smaller number of colors to distinguish items

This reduces visual distractions when reading method signatures.

As discussed in https://github.com/rust-lang/rust/issues/59845#issuecomment-974757191, this categorizes items into one of six colors (down from thirteen):

 - method, function (ochre `#AD7C37`)
 - trait, trait alias (dark slate blue `#6E4FC9`)
 - enum, struct, type alias, union, primitive (maroon `#AD378A`)
 - static, module, keyword, associated type, foreign type (steel blue `#3873AD`)
 - macro (green `#068000`)
 - generic params, self, Self (unmarked black `#000000`)

I slightly tweaked the actual color values so they'd have the same lightness (previously the trait color stood out much more than the others). And I made the color for links in general consistently use steel blue (previously there was a slightly different color for "search-failed").

The ayu and dark themes have been updated according to the same logic. I haven't changed any of the color values in those themes, just their assignment to types.

Demo:

https://rustdoc.crud.net/jsha/fewer-colors/std/string/struct.String.html
https://rustdoc.crud.net/jsha/fewer-colors/std/vec/struct.Vec.html
https://rustdoc.crud.net/jsha/fewer-colors/std/io/trait.Read.html
https://rustdoc.crud.net/jsha/fewer-colors/std/iter/trait.Iterator.html
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 3e7711181f7..16334890da6 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -788,7 +788,7 @@ fn assoc_type(
 ) {
     write!(
         w,
-        "{}type <a href=\"{}\" class=\"type\">{}</a>",
+        "{}type <a href=\"{}\" class=\"associatedtype\">{}</a>",
         extra,
         naive_assoc_href(it, link, cx),
         it.name.as_ref().unwrap()