Stream: rustdoc

Topic: link to definition


view this post on Zulip Jacob Pratt (Aug 08 2021 at 05:19):

@GuillaumeGomez I just saw #84176. In it you said you didn't care for always underlining the links, but I'd like to bring this up in case you weren't aware. There is a text-decoration-color property in CSS, so you could do text-decoration: underline; text-decoration-color: #fff5; for the .example-wrap > pre.rust a and text-decoration-color: #fff; for .example-wrap > pre.rust a:hover, with the font color naturally varying from the theme. I just tried this in my browser and I think it looks decent — not too distracting but still clear that it's a link. This remains the case even in link-dense code. example

view this post on Zulip GuillaumeGomez (Aug 08 2021 at 08:48):

And I'm not a big fan because it makes the reading more difficult in my opinion.

view this post on Zulip Jacob Pratt (Aug 08 2021 at 09:34):

Okay. I disagree, but wasn't sure if you were aware having a semi-transparent underline was even an option. Just wanted to make sure :)

view this post on Zulip GuillaumeGomez (Aug 08 2021 at 17:58):

It's "text decoration" more generally. Playing on colours could work though. For example adding a background (a light one so it doesn't attract attention more than necessary). What do you think?

view this post on Zulip Jacob Pratt (Aug 08 2021 at 20:49):

Yeah, it is text decoration in general, but in this case that's the entirety of it. Adding a light background seems reasonable as well. Here's a #fff1 background. Of course in reality the color would be based on currentColor, it's just that there's no background-opacity property.

example

view this post on Zulip GuillaumeGomez (Aug 09 2021 at 08:18):

You can use rgba for background-color I think. Also, the color difference is too big on your screenshot for me. :)

view this post on Zulip Jacob Pratt (Aug 09 2021 at 08:20):

rgba absolutely works, just saying that you can't do currentColor and then set the opacity separately, which kinda sucks. But that's not particularly relevant for this topic.

view this post on Zulip Jacob Pratt (Aug 09 2021 at 08:21):

The screenshot is #fff1, so 6.7% opacity. I can try setting it lower, but then it almost gets hidden I'd imagine.

view this post on Zulip GuillaumeGomez (Aug 09 2021 at 09:44):

I'm very annoying on such things. :)

view this post on Zulip Jacob Pratt (Aug 09 2021 at 09:46):

clearly :stuck_out_tongue:

view this post on Zulip GuillaumeGomez (Aug 17 2021 at 12:54):

@Jacob Pratt I opened https://github.com/rust-lang/rust/pull/88111, don't hesitate to comment there :)

view this post on Zulip Jacob Pratt (Aug 17 2021 at 14:30):

Minus the invalid line it looks good. rust-highfive could probably be updated to take who opened the PR into account, though


Last updated: Oct 11 2021 at 22:34 UTC