Components
Link
Two link treatments: the quiet link where the ink is already muted, and the ink link inside running prose.
Usage
Quiet link
From the projects index.
Uses.aka-quiet-link.aka-ink-link
<p className="text-13 font-light text-muted-foreground"> From <a href="/demo" className="aka-quiet-link">the projects index</a>. </p>
Keeps the muted ink and a rule in the border colour, and answers hover with full ink and a stronger rule. For bylines, captions and lists.
Examples
Ink link
The argument is in the essay.
<p className="aka-prose"> The argument is in <a href="/writing/digital-gentrification" className="aka-ink-link">the essay</a>. </p>
Full ink at rest and a faint rule, so a paragraph with three of them still reads as a paragraph. The hover takes the select accent, which answers the pointer in both themes.
Accent link
<a href="/aka-style" className="text-primary underline decoration-border underline-offset-[3px]">An accent link</a>
A string, and it prints no hover, so the specimen carries none: a live example that does more than its class string says is the thing these pages exist to prevent.
Best practices
When to use
- aka-quiet-link where the text around it is muted: a byline, a caption, a list.
- aka-ink-link inside running prose.
- A button, not a link, for the one action a page exists to offer.
Behaviour
- Both answer hover with ink, never with a fade, and both keep their underline at rest.
- The quiet link changes over --dur-ink; the ink link changes colour and rule together.
Accessibility
- The underline is what marks a link, so it stays at rest: colour alone is not enough.
- Link text says where it goes. "Read more" alone is not a name.
CSS
The rules, as globals.css has them, with the reasoning the stylesheet keeps beside them.
@layer components {
/*
* The quiet link: the link inside a byline, a caption, a list, anywhere
* the ink is already muted. It keeps that ink and a rule in the border
* colour, and answers hover with full ink and a stronger rule. `.aka-ink-link`
* is the other one, for running prose, where the link starts at full ink and
* answers in the select accent. A decoration colour cannot carry an alpha
* through a utility in Tailwind 3, which is why the hover rule is mixed here.
*/
.aka-quiet-link {
text-decoration-line: underline;
text-decoration-color: var(--border);
text-underline-offset: 3px;
transition-property: color, text-decoration-color;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: var(--dur-ink);
}
@media (hover: hover) {
.aka-quiet-link:hover {
color: var(--foreground);
text-decoration-color: color-mix(in srgb, var(--foreground) 50%, transparent);
}
}
}
@layer components {
/* A link inside running text: full ink, and a rule faint enough that a
paragraph with three of them still reads as a paragraph.
The hover takes the select accent, so a link answers the pointer in both
themes. Darkening the underline alone only ever worked in one of them: in
light the resting rule is grey on paper and a darker grey was nearly
invisible, while dark already read well, because a white-mix underline
jumps further from a near-black page. */
.aka-ink-link {
color: var(--foreground);
text-decoration-line: underline;
text-underline-offset: 3px;
text-decoration-color: color-mix(in srgb, var(--foreground) 30%, transparent);
transition: color var(--dur-ink) ease, text-decoration-color var(--dur-ink) ease;
}
.aka-ink-link:hover {
color: var(--select);
text-decoration-color: color-mix(in srgb, var(--select) 70%, transparent);
}
}