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.
std::fs::File::open
, returning io::Result
, noted in orange
std::str::FromStr::from_str
, returning std::result::Result
, noted in green
A couple of times when I've seen these two Result
s 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.
The f32
s in this example are primitives, rendered in light blue.
Function names, rendered in a dusky pink.
Option
, an enum, rendered in green.
IntoIterator
, PartialEq
, and PartialOrd
, traits, and both sets of Item
s, associated types, rendered in purple.
Box
, a struct, rendered in red.
This 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.)