Skip to content

Primer branding: fix undefined --fg-default color token - #330

Merged
pelikhan merged 1 commit into
mainfrom
primer-branding/fix-undefined-fg-token-4039c9283c19b254
Oct 14, 2026
Merged

pelikhan merged 1 commit into
mainfrom
primer-branding/fix-undefined-fg-token-4039c9283c19b254

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

What changed

Color

  • .btn-evals referenced color: var(--fg-default), but --fg-default is never defined in either the light (:root) or dark ([data-color-mode="dark"]) theme blocks in src/styles/style.css, and the declaration had no fallback value. Per CSS custom-property semantics, an undefined var with no fallback makes the whole color declaration invalid at computed-value time, so the property is treated as unset and silently inherits from body { color: var(--text-primary); } instead. Visually this currently "works by accident," but it violates token consistency — every other button variant in the file (.btn-primary, .btn-assistant, .copy-modal-action, etc.) resolves its text color through an explicitly defined custom property.
  • Fixed by pointing .btn-evals at the already-defined --text-primary token (the same semantic role used by body and other neutral-text elements), which is the correct source-of-truth token for default foreground text in this codebase's token system.

Guidance that motivated this change

The brand audit instructions call out, as a priority deviation category: "hard-coded hex values that should use Primer CSS variables or brand tokens" and more broadly, consistent token usage across light/dark mode. While --fg-default isn't a hard-coded hex, it's an undefined/invented token reference with the same root problem — it doesn't trace back to any defined design token in the project's palette (which otherwise closely mirrors Primer's functional color roles such as --brand-color-text-default / --brand-color-text-muted from the primer-brand MCP token set: var(--brand-color-text-default) = var(--base-color-scale-black-0)).

Audit findings not changed (and why)

  • The existing warm-neutral palette (--bg-primary, --text-primary, --accent-blue, label colors, etc.) is a deliberate, cohesive brand-adjacent system layered on top of @primer/css, not raw ad-hoc hex sprinkled arbitrarily. I verified contrast ratios for the main text/background and label-badge combinations (all ≥ 4.5:1, most 5–13:1), so no accessibility-contrast issues were found that needed fixing.
  • --color-success-fg, --color-danger-fg, --color-attention-fg, --color-prettylights-syntax-*, and --borderRadius-medium/large are also "undefined" in this file, but each of those appears only as the fallback argument inside var(--token, fallback) (e.g. var(--success, #1a7f37)), which is valid, intentional, and safe — they are not bugs, so I left them untouched to keep the change set minimal.
  • Typography (Mona Sans, the correct Primer Brand variable typeface), spacing (rem-based scale), and voice/tone (concise, direct copy like "Create Your Agentic Workflow", "Takes about a minute — no sign-in required") were reviewed and found already on-brand; no changes made there.

Validation

  • npm test — 329 tests passed (19 test files), no regressions.
  • npx vite build — production bundle built successfully (36.67 kB CSS, 61.75 kB JS, no errors). Note: the repo's prebuild npm script (npm run build) also runs scripts/fetch-vendor-assets.mjs, which requires outbound npm registry access to vendor @primer/css; that step fails in this sandboxed environment with an unrelated 403 (network policy), not because of anything in this change — the underlying Vite build itself completes cleanly.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "registry.npmjs.org"

See Network Configuration for more information.

Generated by Primer Branding · copilot · auto · 142.6 AIC · ⌖ 6.79 AIC · ⊞ 9.5K · ◷

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 14, 2026 05:00
@pelikhan
pelikhan merged commit fe1f87a into main Oct 14, 2026
3 of 6 checks passed
@pelikhan
pelikhan deleted the primer-branding/fix-undefined-fg-token-4039c9283c19b254 branch October 14, 2026 05:00
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.

1 participant