Skip to content

Replace hardcoded status colors and phantom CSS variables in diagnostic-panel and invitations-inbox with design tokens #2592

Closed

Description

@malibio

Overview

packages/desktop-app/src/app.css defines the semantic color token system (--muted-foreground, --warning, --primary, --success, --destructive, --background, --foreground, --border) as HSL triplets, with a full light set on :root and a dark set on .dark. Two components bypass this system: diagnostic-panel.svelte and invitations-inbox.svelte.

Scope note: this issue originally targeted pro-sync-pill.svelte, enable-sync-pill.svelte and pro-teaser-pill.svelte. All three were deleted in #2627 ("Remove the top-right NodeSpace Pro pill; add Settings > Account"), along with their four test files, so that scope no longer exists. The issue has been repurposed onto the two surviving components that carry the same defect. The original audit intent is unchanged.

Problem Statement

1. Hardcoded status colors

Both files hardcode status/state colors that the token system already names:

packages/desktop-app/src/lib/design/components/diagnostic-panel.svelte

  • L291 .stats-bar .success → #3fb950
  • L295 .stats-bar .error → #f85149
  • L312 .log-entry.error → border-color: #f85149
  • L316 .log-entry.pending → border-color: #d29922
  • L339 .status.success → background: #238636
  • L344 .status.error → background: #da3633
  • L225 .init-error-banner → background: #da3633
  • L380 .error-msg → #f85149

packages/desktop-app/src/lib/components/collaboration/invitations-inbox.svelte

  • L380 .ok → #16a34a (rendered with role="status")
  • L375/L385 .err / .btn-logout → #dc2626 (.err rendered with role="alert")
  • L331-332 .tag-restricted → background: #fef3c7; color: #92400e
  • L335-336 .tag-open → background: #dcfce7; color: #166534
  • L286/L365 .link / .btn-primary → #2563eb

2. References to CSS variables that do not exist

Both files also reference a parallel variable vocabulary that is defined nowhere in the repository, so every one of these resolves to its hardcoded fallback, permanently:

--color-bg-secondary, --color-bg-tertiary, --color-bg-hover, --color-text, --color-text-muted, --color-border, --color-primary, --surface-1, --surface-2, --text-primary, --text-secondary, --border-color

Verify with: grep -rn -- "--surface-1:" packages/desktop-app/src → zero hits (same for each name above).

The consequence is not cosmetic. invitations-inbox.svelte is a user-facing modal whose fallbacks are all light-mode values (--surface-1, #ffffff, --text-primary, #1f2937, --surface-2, #e5e7eb). It renders as a white panel with dark text in dark mode regardless of theme — a genuine theming bug, currently masked by token-shaped syntax that does nothing.

Proposed Solution

Map by semantic meaning, not nearest hex. Tokens are HSL triplets, so the correct form is hsl(var(--token)) — not rgb(var(--token) / alpha). For tinted rings/glows use hsl(var(--token) / <alpha>), the pattern already established at packages/desktop-app/src/lib/styles/noderef.css:386:

box-shadow: 0 0 0 2px hsl(var(--status-online) / 0.3);

Status mappings:

Current Token
#3fb950, #238636, #16a34a, #dcfce7/#166534 (success/ok/open) --success / --success-light
#f85149, #da3633, #dc2626 (error/failed/destructive) --destructive
#d29922, #fef3c7/#92400e (pending/restricted) --warning / --warning-light
#2563eb, #58a6ff (link/primary action) --primary

For foreground-on-colored-surface pairs (.status.success, .tag-open, .init-error-banner), use the matching --*-foreground token rather than a literal white.

Chrome mappings (the phantom-variable cleanup): --surface-1 → --background or --card, --text-primary → --foreground, --text-secondary → --muted-foreground, --border-color → --border, --surface-2 → --muted.

diagnostic-panel.svelte is intentionally a dark console

Unlike the inbox, this panel is a fixed-position developer tool (monospace, #1e1e1e surface, #e0e0e0 text) and is deliberately dark in both themes. Do not map its surface/text chrome to --background/--foreground — that would make it turn white in light mode and destroy the console affordance. Either keep its surface palette as explicit literals with the dead var(--color-*, …) wrappers removed (so the intent is honest), or define real dark-console tokens for it. Its status colors must still be tokenized, since --success/--destructive/--warning are legible against a dark surface in both theme sets.

Acceptance Criteria

  • No hardcoded hex or rgba() status-indication literals remain in diagnostic-panel.svelte or invitations-inbox.svelte — all success/error/pending/primary states use hsl(var(--token))
  • No references remain to undefined variables (--surface-1, --surface-2, --text-primary, --text-secondary, --border-color, --color-bg-*, --color-text*, --color-border, --color-primary) in either file; each is either a real app.css token or an intentional literal with no misleading var() wrapper
  • invitations-inbox.svelte renders correctly in dark mode — surface, text, borders and state tags all track the theme (verified by toggling .dark)
  • diagnostic-panel.svelte remains a dark console in both themes; its status colors track the token set
  • Modal scrim/drop-shadow rgba(0, 0, 0, …) values may remain (decoration, not state) or move to hsl(var(--border) / …); either is acceptable
  • bun run quality:fix passes
  • bun run test:all passes with no new failures vs. baseline (242 files / 4995 tests)

Technical Specifications

  • Token source of truth: packages/desktop-app/src/app.css — light on :root (L12-53), dark on .dark (L104-145)
  • Ring/glow precedent: packages/desktop-app/src/lib/styles/noderef.css:386
  • Note: in dark mode --border is 0 0% 100% / 0.1 — it already carries alpha, so avoid hsl(var(--border) / 0.2) on top of it
  • Dark mode is class-based (.dark), not a media query

Related Issues

Activity

  1. changed the title [-]Replace hardcoded status colors in sync/pro pill components with design tokens[/-] [+]Replace hardcoded status colors and phantom CSS variables in diagnostic-panel and invitations-inbox with design tokens[/+] on Sep 16, 2026
  2. malibio commented on Sep 16, 2026

    @malibio
    CollaboratorAuthor

    Baseline on worktree issue-2592-pill-status-tokens (branched from main @ b03070a): Frontend: 242 test files passed, 4995 tests passed, exit 0.

    Repurposing note: the three files this issue originally targeted (pro-sync-pill.svelte, enable-sync-pill.svelte, pro-teaser-pill.svelte) were deleted in #2627 along with their four test files, so the original scope no longer exists. Title and body have been rewritten onto the two surviving components carrying the same defect: diagnostic-panel.svelte and invitations-inbox.svelte.

    Two corrections captured in the rewrite: (1) the prescribed rgb(var(--token) / alpha) form is wrong for this codebase -- app.css tokens are HSL triplets, so the correct form is hsl(var(--token)), per the existing precedent at noderef.css:386; (2) both files reference ~12 CSS variables that are defined nowhere in the repo and always resolve to their hardcoded fallbacks, which leaves invitations-inbox.svelte hardcoded to light-mode colors and broken in dark mode.

  3. self-assigned this
    on Sep 16, 2026
  4. malibio commented on Sep 16, 2026

    @malibio
    CollaboratorAuthor

    Filed #2668 for the token-set gap this work surfaced: light-mode --success is 2.83:1 as text on --card (WCAG AA needs 4.5:1), and --success-light is worse at 1.52:1, so the .ok status text in invitations-inbox.svelte is left below AA in light mode — every available token alternative scored worse. Also captured there: --success-foreground and --destructive-foreground are white in BOTH themes, so the solid-fill pairing their names imply lands at 2.55-2.83:1, which is why the badges here tint the background and use the state color as text instead.

  5. added a commit that references this issue on Sep 16, 2026
    c68e3f5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions