Make links visually distinguishable from body text - #405
Open
seandavi wants to merge 1 commit into
Open
Conversation
typography.css set `a { color: black }` globally, which is also the body
text colour, so links carried no colour affordance. footer.css stripped
text-decoration from every footer descendant, removing the underline too,
leaving footer links with no distinguishing cue at all.
Use --misc-neutral for links. It is the only existing token clearing both
relevant thresholds: 4.90:1 against white (WCAG AA for text) and 4.11:1
against --default-body (WCAG 1.4.1, 3:1 where colour separates a link from
surrounding text). --primary-p400 gives 8.06:1 on white but only 2.50:1
against body text; --primary is the reverse.
In the footer, keep #fff for contrast on the dark background and restore
the underline, since colour cannot do the work there.
Components that need their own treatment (.header-size a, .header-button,
buttons.css) already set colour explicitly and are unaffected; verified in
a browser that header links still compute to rgb(7,7,7).
Fixes #399
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YBSvPwEk6sH1rhGmjPmsFq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #399.
Two rules between them removed every visual cue that something is a link:
assets/style/base/typography.css:59—a { color: black }, andbodyis--default-body(#070707). Links were effectively the same colour as the text around them.assets/style/sections/footer.css:16-19—footer * { color: #fff; text-decoration: none }stripped the underline from every footer link, so footer links had neither colour nor underline.Choosing the colour
I picked
--misc-neutral(#007a9f) after checking the existing tokens against both thresholds that apply here — contrast against the background (WCAG AA, 4.5:1) and contrast against surrounding body text (WCAG 1.4.1, 3:1, which applies when colour is what separates a link from its text):--primary-p400--primary--primary-p500--primary-p200--misc-neutralMy first attempt used
--primary-p400, which looks like the obvious brand choice and has excellent contrast on white — but only 2.50:1 against body text, so it would have traded one indistinguishability problem for a subtler one.In the footer the background is #121212, so white has to stay for contrast (18.73:1) and the underline does the work instead.
Verified
Rendered the real header, a body paragraph, and the real footer against the actual stylesheets in headless Chromium:
Header links are unaffected because
.header-size asets--misc-darkexplicitly; the same is true of.header-buttonand everything inbuttons.css. The change reaches links in body content, which is the intent.Worth a human eye
This is a small diff with site-wide visual reach, and I can't build the full site locally to check it across page types. Body-content links on generated package landing pages in particular are worth a look before merging — that's ~7,600 pages inheriting the base rule with their own legacy CSS alongside it.
If the project would rather keep links black, the alternative that still satisfies #399 is to give body links a permanent underline and leave the colour alone. That's a one-line change in the same place; say the word and I'll swap it.
🤖 Generated with Claude Code
https://claude.ai/code/session_01YBSvPwEk6sH1rhGmjPmsFq