A sort of under-appreciate feature in rustdoc is the colors it uses to denote what types of things it’s linking to. For example, an important distinction can be made between
std::io::Result and the regular
std::result::Result - the former is a type alias, and is rendered in orange, but the latter is an enum, and rendered in green.
io::Result, noted in orange
std::result::Result, noted in green
A couple of times when I’ve seen these two
Results confused in #rust-beginners, I’ve noted that you could tell
io::Result was different due to its color. But it got me wondering, how are the colors used in rustdoc perceived by colorblind people?
I chatted with the docs team about it today, and I wanted to see what the wider community thought. If you or someone you know is colorblind, please take a look at the examples below and let us know if any of them are hard to distinguish from each other.
f32s in this example are primitives, rendered in light blue.
Function names, rendered in a dusky pink.
Option, an enum, rendered in green.
PartialOrd, traits, and both sets of
Items, associated types, rendered in purple.
Box, a struct, rendered in red.
Result, returned by
std::io::copy, is a type alias, rendered in orange.
(If I’ve missed any significant examples of things that get hyperlinked, let me know and I can add them to this post. I’d like to not include the syntax highlighting in full code blocks, just the elements in function/struct/enum/trait references that get hyperlinked, as they confer semantic information above just the name of the item being referenced.)