Give tooltips their own two theming tokens - #446
Merged
Conversation
Tooltips had no tokens of their own, so each one borrowed its surface
and text colour from an unrelated family. Those pairings hold at the
framework defaults and come apart under a custom desktop theme, and
there was no name a theme could aim at to fix one without moving the
other thing that token controls.
- `.desktop-mode-dock__tooltip` took its surface from `--wpd-scrim`,
an overlay BACKDROP. The Neon Glass reference theme sets that to
`rgba( 6, 4, 24, 0.68 )` for its modals, which made every dock
tooltip 68% opaque with the wallpaper reading through the label.
Dropping the scrim's alpha would have made every modal backdrop
opaque.
- `.desktop-mode-content-graph__tooltip` paired
`--wpd-surface-elevated` with `--wpd-fg-on-accent`. A light theme
sets the first light and leaves the second white: white text on a
white chip. Retuning either would have moved raised strips or the
text on accent-filled buttons.
`--desktop-mode-tooltip-bg` / `--desktop-mode-tooltip-fg` are that
name. All three tooltip surfaces — dock tile, Corkboard satellite, and
the site window's entity hover card — read the dedicated token first
with their old chain as the fallback.
Both are left UNDECLARED, matching the `--wpd-*` palette and the
texture family: every site reads `var( --desktop-mode-tooltip-bg,
<the chain it always had> )`, so an unthemed shell computes exactly
the literals it did before. No default drift, no flag day.
No PHP needed — `desktop_mode_sanitize_desktop_theme_tokens()` already
accepts anything matching `^--desktop-mode-[a-z0-9-]+$`.
Secondary text inside the richer tooltips (the hover card's excerpt)
still follows `--wpd-fg-muted`; these two cover the surface and the
primary text on it. Documented as the boundary rather than expanding
the surface with a third token.
The test asserts both halves of the contract: each surface reads the
token first with its exact prior fallback, and neither token is
declared anywhere. Against stylesheet text, because jsdom will not
resolve a nested `var()` chain against undeclared properties, so a
computed-style assertion would prove nothing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015sKW1mu1SGg5k9oSHgxv5s
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.
Tooltips had no tokens of their own, so each one borrowed its surface and text colour from an unrelated family. Those pairings hold at the framework defaults and come apart under a custom desktop theme — and there was no name a theme could aim at to fix one without moving the other thing that token controls.
.desktop-mode-dock__tooltiptook its surface from--wpd-scrim, an overlay backdrop. The Neon Glass reference theme sets that torgba( 6, 4, 24, 0.68 )for its modals, which made every dock tooltip 68% opaque with the wallpaper reading through the label. Dropping the scrim's alpha to fix it would have made every modal backdrop opaque..desktop-mode-content-graph__tooltippaired--wpd-surface-elevatedwith--wpd-fg-on-accent. A light theme sets the first light and leaves the second white — white text on a white chip. Retuning either would have moved raised strips, or the text on accent-filled buttons.What changed
--desktop-mode-tooltip-bg/--desktop-mode-tooltip-fgare that name. All three tooltip surfaces read the dedicated token first, with their old chain as the fallback:assets/css/dock.cssassets/css/content-graph.cssassets/css/my-wordpress.cssBoth tokens are left undeclared, matching the
--wpd-*palette and the texture family: every site readsvar( --desktop-mode-tooltip-bg, <the chain it always had> ), so an unthemed shell computes exactly the literals it did before. No default drift, no flag day.No PHP needed —
desktop_mode_sanitize_desktop_theme_tokens()already accepts anything matching^--desktop-mode-[a-z0-9-]+$. Verified by running the real sanitizer over an updated manifest: nothing dropped.Scope note
Secondary text inside the richer tooltips — the hover card's excerpt — still follows
--wpd-fg-muted. These two tokens cover the surface and the primary text on it. A theme setting a darktooltip-bginside an otherwise-light palette would want a--desktop-mode-tooltip-fg-mutedcompanion; I documented that boundary rather than expanding the surface with a third token unasked.Docs
New Tooltips subsection under Shell tokens in
docs/desktop-themes.md— the table, a JSON snippet, and why setting them explicitly is worth it.Tests
tests/vitest/tooltip-tokens.test.tspins both halves of the contract: each surface reads the token first with its exact prior fallback, and neither token is declared anywhere. Asserted against stylesheet text, because jsdom will not resolve a nestedvar()chain against undeclared properties — a computed-style assertion would prove nothing.Gates:
npm run build,lint,typecheck, andtest:js(256 files / 2481 tests) all green. No PHP touched.Testing
Hover any dock icon. For the other two: open Corkboard, click a node so satellites fan out, hover a satellite bubble; open the window named after your site and hover a post or user tile.
To exercise the tokens without a theme:
Or upload this theme :)
neon-glass.zip
All three turn purple.
removePropertyon both should return them to exactly their previous look — that's the undeclared-by-default half, and the part most worth confirming by eye.🤖 Generated with Claude Code