Skip to content

Make links visually distinguishable from body text - #405

Open
seandavi wants to merge 1 commit into
develfrom
fix/link-affordance
Open

Make links visually distinguishable from body text#405
seandavi wants to merge 1 commit into
develfrom
fix/link-affordance

Conversation

@seandavi

Copy link
Copy Markdown

Fixes #399.

Two rules between them removed every visual cue that something is a link:

  • assets/style/base/typography.css:59a { color: black }, and body is --default-body (#070707). Links were effectively the same colour as the text around them.
  • assets/style/sections/footer.css:16-19footer * { 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):

token on white vs body text
--primary-p400 #035771 8.06 2.50 fails vs body
--primary #3792ad 3.57 5.64 fails on white
--primary-p500 #003242 13.68 1.47 fails vs body
--primary-p200 #59a5bb 2.79 7.22 fails on white
--misc-neutral #007a9f 4.90 4.11 passes both

My 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:

body text    rgb(7, 7, 7)     none
body link    rgb(0, 122, 159) underline
header link  rgb(7, 7, 7)     none        <- unchanged
footer link  rgb(255,255,255) underline

Header links are unaffected because .header-size a sets --misc-dark explicitly; the same is true of .header-button and everything in buttons.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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Links are visually indistinguishable from body text (a { color: black })

1 participant