Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/harder-button-edges.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@elide/tokens": patch
"@elide/ui": patch
---

Give buttons a hard edge. The gradient and primary rim sat between the face and
the page in tone, with a blurred glow under it, so the edge read as soft. The
rim now contrasts with both: deeper than the face in the light theme, lighter
than it in the dark theme. `--button-shadow` is one unblurred pixel of shade in
place of the glow. The outline button's rim goes from 25% to 40% of the
foreground and loses its shadow.
26 changes: 18 additions & 8 deletions packages/tokens/src/tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@
--primary-emphasis: var(--eld-purple-800);
--primary-soft: color-mix(in oklab, var(--eld-purple-700) 7%, transparent);

/* External depth only; the border defines the edge without a white seam. */
--button-shadow: 0 1px 2px #2e10651a, 0 3px 8px -3px #6d28d933;
--button-shadow-hover: 0 2px 4px #2e10651a, 0 6px 14px -5px #6d28d94d;
/* One unblurred pixel of shade under the button, no glow: the rim is the
* button's edge, and any blur around it made that edge read as soft. */
--button-shadow: 0 1px 0 #2e10651f;
--button-shadow-hover: 0 1px 0 #2e106533;

/* Status text/icons (--*-emphasis) and tinted surfaces (--*-soft) */
--info-emphasis: var(--eld-info-deep);
Expand Down Expand Up @@ -299,8 +300,8 @@
--primary-emphasis: var(--eld-purple-300);
--primary-soft: color-mix(in oklab, var(--eld-purple-400) 12%, transparent);

--button-shadow: 0 1px 3px #00000040, 0 3px 10px -4px #7c3aed40;
--button-shadow-hover: 0 2px 5px #00000040, 0 7px 18px -6px #7c3aed66;
--button-shadow: 0 1px 0 #00000066;
--button-shadow-hover: 0 1px 0 #0000008c;

--info-emphasis: var(--eld-info-strong);
--info-soft: color-mix(in oklab, var(--eld-info-strong) 14%, transparent);
Expand Down Expand Up @@ -427,15 +428,24 @@
:root,
.dark,
[data-theme="dark"] {
/* Match all three fill stops and deepen them evenly for a crisp 1px edge.
/* The rim follows all three fill stops, moved away from the face and from
* the page at once, so it reads as one hard line: deeper than the face on a
* light page, lighter than it on a dark one (below). A rim between the face
* and the page in tone looks like the face's edge blurring into the page.
* Layered backgrounds clip the face to padding-box and this rim to border-box. */
--button-border-background: linear-gradient(115deg, color-mix(in oklab, var(--eld-gradient-start) 82%, black), color-mix(in oklab, var(--eld-gradient-middle) 82%, black) 65%, color-mix(in oklab, var(--eld-gradient-end) 82%, black));
--button-border-hover-background: linear-gradient(115deg, color-mix(in oklab, var(--eld-gradient-start) 76%, black), color-mix(in oklab, var(--eld-gradient-middle) 76%, black) 65%, color-mix(in oklab, var(--eld-gradient-end) 76%, black));
--button-border-background: linear-gradient(115deg, color-mix(in oklab, var(--eld-gradient-start) 68%, black), color-mix(in oklab, var(--eld-gradient-middle) 68%, black) 65%, color-mix(in oklab, var(--eld-gradient-end) 68%, black));
--button-border-hover-background: linear-gradient(115deg, color-mix(in oklab, var(--eld-gradient-start) 60%, black), color-mix(in oklab, var(--eld-gradient-middle) 60%, black) 65%, color-mix(in oklab, var(--eld-gradient-end) 60%, black));
--button-primary-background: var(--eld-gradient-brand);
--button-primary-hover-background: var(--eld-gradient-hover);
--button-accent-background: linear-gradient(115deg, var(--primary-soft), color-mix(in oklab, var(--eld-gradient-end) 10%, transparent));
}

.dark,
[data-theme="dark"] {
--button-border-background: linear-gradient(115deg, color-mix(in oklab, var(--eld-gradient-start) 72%, white), color-mix(in oklab, var(--eld-gradient-middle) 72%, white) 65%, color-mix(in oklab, var(--eld-gradient-end) 72%, white));
--button-border-hover-background: linear-gradient(115deg, color-mix(in oklab, var(--eld-gradient-start) 64%, white), color-mix(in oklab, var(--eld-gradient-middle) 64%, white) 65%, color-mix(in oklab, var(--eld-gradient-end) 64%, white));
}

/* The selected theme also controls browser UI. light-dark() keeps paired
* colors together; explicit light/dark declarations above remain the fallback. */
@supports (color: light-dark(white, black)) {
Expand Down
5 changes: 4 additions & 1 deletion packages/ui/src/components/button-variants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { cva } from "class-variance-authority";
* `gradient` is the purple-to-rose CTA (the "Install" button). `changelog` is the
* softly tinted accent affordance used in the docs nav.
*
* Edges are hard: a 1px rim with clear contrast against both the face and the
* page, and no blurred shadow around it (`outline` has none at all).
*
* The hover surface (including its border and shadow) fades on ::before.
* Its isolated negative stack keeps it behind the label without extra markup,
* including when the classes are composed onto an anchor. The hit area stays
Expand All @@ -30,7 +33,7 @@ export const buttonVariants = cva(
gradient:
"text-primary-foreground [background:var(--eld-gradient-brand)_border-box_padding-box,var(--button-border-background)_border-box] shadow-[var(--button-shadow)] before:[background:var(--eld-gradient-hover)_border-box_padding-box,var(--button-border-hover-background)_border-box] before:shadow-[var(--button-shadow-hover)] supports-[background-clip:border-area]:[background-clip:padding-box,border-area] supports-[background-clip:border-area]:before:[background-clip:padding-box,border-area]",
outline:
"border-foreground/25 bg-card text-foreground shadow-xs before:border-primary-emphasis/60 before:bg-primary-soft",
"border-foreground/40 bg-card text-foreground before:border-primary-emphasis/70 before:bg-primary-soft",
ghost:
"bg-transparent text-muted-foreground before:bg-primary-soft",
changelog:
Expand Down