Skip to content

fix(platform): apply brand color to primary-action button token - #2483

Merged
yannickmonney merged 7 commits into
mainfrom
fix/brand-color-2394
Jul 7, 2026
Merged

yannickmonney merged 7 commits into
mainfrom
fix/brand-color-2394

Conversation

@yannickmonney

Copy link
Copy Markdown
Contributor

Summary

Setting an organization brand color had no visible effect on the flagship primary UI. The brand color was injected only as the legacy --primary HSL token (branding-provider.tsx), but the primary Button variant in @tale/ui styles with the canonical tokens --color-accent-base / --color-accent-fg (bg-accent-base text-accent-fg) — which the provider never set. Two token vocabularies coexist (see packages/ui/src/globals.css header) and only one was wired.

This takes the issue's "if brand color stays" branch: map the brand color onto the token the design system actually uses for primary actions/highlights, in both themes, with contrast handling — without collapsing the two-field contract or a data migration (that broader redesign stays with #1960).

  • Inject --color-accent-base (raw hex) and --color-accent-fg (#030712/#ffffff to match the globals.css accent-fg tokens) from the theme-adjusted, contrast-checked brand color, alongside the existing --primary / --primary-foreground.
  • Reuse the existing adjustColorForTheme / isLightColor helpers — no new hex logic, no hardcoded brand color.
  • accentColor keeps its existing navigation-highlight effect; both branding fields now have a visible product effect.

Contract / scope decision

  • brandColor → primary-action surface: --primary (badges, chat cards) and --color-accent-base/--color-accent-fg (primary Button + accent surfaces).
  • accentColor → navigation highlight (unchanged; already wired inline in navigation.tsx / tab-navigation.tsx / mobile-bottom-nav.tsx).
  • No shared @tale/ui Button change (it's used by app/web/docs which have no brand color); the fix lives at the injection site.

Closes #2394. Cross-linked with #1960 (the single-accent redesign + Convex migration remains that issue's scope).

Test plan

  • New regression test branding-provider.test.tsx — observed red on old code (--color-accent-base empty), green after the fix; also asserts --primary stays wired and that nothing is injected when no brand color is set.
  • bun run --filter @tale/platform test --project client app/components/branding app/features/settings/branding — 43 passed.
  • bun run format, bun run lint — clean; @tale/platform typecheck clean.
  • Pre-commit format + SAST clean.

Acceptance criteria

Caveats

  • Live authenticated-app browser verification (dashboard + Convex + a seeded org) was not run in this environment. The fix is observed via the jsdom regression test exercising the provider's real document.documentElement.style.setProperty calls; the consumption side (bg-accent-base → --color-accent-base, defined in globals.css) is source-verified. The existing --primary injection uses the identical CSSOM mechanism and is confirmed working in the issue.
  • Overriding --color-accent-base in the dashboard tints all accent-base surfaces (buttons, checkbox-checked, slider, section, accordion) with the brand color — the intended semantics of a brand color; contrast is handled per theme. Only runs where an active org is set (login/shell untouched).

Made with Cursor

The org brand color was injected only as the legacy `--primary` HSL token,
which the flagship primary `Button` variant does not consume — it styles
with the canonical `@tale/ui` `--color-accent-base` / `--color-accent-fg`
tokens. So setting a brand color left primary buttons (and other accent
surfaces) unchanged.

Also inject the brand color into `--color-accent-base` / `--color-accent-fg`
(theme-adjusted, contrast-handled) so primary UI visibly restyles in both
light and dark, while keeping `--primary` wired for the badges/chat cards
that read it. Locks the behaviour with a regression test on the provider's
CSS-variable injection.

Co-authored-by: Cursor <[email protected]>
@yannickmonney
yannickmonney force-pushed the fix/brand-color-2394 branch from 3ae7ab6 to 93623ad Compare July 4, 2026 13:12
yannickmonney and others added 6 commits July 4, 2026 15:20
Wait longer for the create-org Skip step during worker bootstrap and give
the docs Playwright webServer more time after the search-index build.
The chat-picker spec toggled visible-in-chat only when off but always
waited for Save to enable; when a prior serial test already saved
visibility, Save stayed disabled and the shard failed.
# Conflicts:
#	services/platform/tests/e2e/specs/external-agent.spec.ts
@yannickmonney
yannickmonney merged commit 8fc8c1e into main Jul 7, 2026
68 of 69 checks passed
@yannickmonney
yannickmonney deleted the fix/brand-color-2394 branch July 7, 2026 06:05
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.

Bug: Brand color is saved and injected as --primary, but no visible UI consumes it — setting it has no effect

1 participant