Skip to content

Document how to use your own brand palette - #413

Merged
jasverix merged 4 commits into
mainfrom
claude/component-library-brand-colors-vmjb02
Sep 22, 2026
Merged

jasverix merged 4 commits into
mainfrom
claude/component-library-brand-colors-vmjb02

Conversation

@akselkvitberg

@akselkvitberg akselkvitberg commented Sep 22, 2026

Copy link
Copy Markdown
Member

Change summary

Docs only. Overriding the brand palette already works. Nothing documented it, and it takes two ramps.

Set both in your own CSS, after the library import:

Ramp Covers
--color-brand-100..1000 Semantic brand tokens: PrimeVue components, links, focus and selected states, bg-brand-* / text-brand-*
--color-default-bcc-100..1000 The ctx-brand-* context utilities. Mode-aware, so dark mode reverses it

Miss the second and the ctx-brand-* contexts stay teal while the rest of the UI changes.

PrimeVue components

Testing this in a product turned up a gap: with both ramps set, --p-primary-color stayed #014d49. The PrimeVue preset in @bcc-code/design-tokens defined primitive.color.brand as literal hex, so --p-primary-* never read --color-brand-*. Ten components kept the teal — slider, rating, knob, datatable, treetable, tree, editor, timeline, galleria, fileupload — along with the overlay selection highlight.

design-tokens 5.2.10 points primitive.color.brand at the CSS variables and fixes it at the source. 91ffb22 bumps the dependency, so the two ramps above are enough and no PrimeVue-specific override is needed.

Changes

  • component-library/README.md — "Brand color" section: full example, dark mode values, where to put the blocks for each styling option.
  • component-library/docs/foundations/Colors.mdx — "Using your own brand palette" in Foundations › Colors. Condensed, links to the Readme and to Styles › Context.

llms.txt and llms-full.txt generate from the Storybook pages, and the Readme page inlines README.md, so both sections reach the AI docs endpoints without touching the generator.

Verification

Applied the README snippet verbatim to rendered components in Chromium on design-tokens 5.2.10: a primary button and a slider range both give #1d4ed8 in light and #bfdbfe in dark, and stay teal without it. The slider is the check that matters here, since it was one of the ten that ignored the override on 5.2.8.

Storybook builds, the llms generator's quality check passes, and all fourteen docs pages the e2e suite covers load without errors.

Colors.mdx writes asterisks in token patterns as *, because MDX reads a pair of literal asterisks as emphasis and then fails to index the page.

Change type

  • No review
  • Small PR
  • Big PR
  • Refactor

🤖 Generated with Claude Code

https://claude.ai/code/session_01LyYwdsJiGLEyRrJ6tVdnpK

An app can already supply its own brand palette without any library change, but
nothing said so, and the override needs two differently named ramps to be
complete:

- --color-brand-100..1000 feeds the semantic brand tokens, and through them the
  PrimeVue preset — primary buttons, checkboxes, focus and selected states,
  links, and the bg-brand-* / text-brand-* utilities. One set of values covers
  both colour schemes.
- --color-default-bcc-100..1000 feeds the ctx-brand-* context utilities. It is
  mode-aware, so dark mode takes the same palette in reverse.

Overriding only the first leaves ctx-brand-* on the BCC teal while everything
else changes, which is easy to hit and hard to diagnose.

Documented in the README, and in Foundations > Colors where someone looking for
how to change colours will actually go. The llms.txt and llms-full.txt outputs
are generated from the Storybook docs pages, so both sections flow into them
with no change to the generator.

The asterisks in token patterns are written as * in the MDX because MDX
parses a pair of them as emphasis, which breaks indexing of the page. A
backslash escape parses but leaks the backslash into the generated markdown,
since escapes are not processed inside code spans; the numeric entity is decoded
on both paths.

Verified in Chromium that the documented snippet works verbatim on all three
consumer paths — src/style.css, the published theme.css compiled by the app's
own Tailwind, and the pre-built style.css with the override in a later
stylesheet — in both light and dark mode. Storybook builds, the llms generator's
quality check passes, both sections appear in llms-full.txt with the token
patterns and links rendered cleanly, and all fourteen docs pages the e2e suite
covers load without page errors.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LyYwdsJiGLEyRrJ6tVdnpK

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Correct the unresolved palette mappings, dark-mode guidance, and stylesheet import instructions.

Review effort: Lite
Findings: None

What changed in this PR

Documents custom brand palette overrides for the component library.

Changes:

  • Added complete customization guidance to README.md.
  • Added condensed palette documentation to Colors.mdx.
  • Documented dark mode, contrast, and CSS placement.
File Description
component-library/​README.md Brand palette customization instructions and example.
component-library/​docs/​foundations/​Colors.mdx Condensed brand palette guidance and example.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@akselkvitberg akselkvitberg changed the title Document brand color customization in README and Colors docs Document how to use your own brand palette Sep 22, 2026
@akselkvitberg
akselkvitberg marked this pull request as draft September 22, 2026 08:20
The two documented ramps are not enough. The PrimeVue theme preset in
@bcc-code/design-tokens carries the brand ramp as literal values in
primitive.color.brand, and semantic.primary references it through PrimeVue's own
token syntax, resolved at theme-generation time. That chain never sees
--color-brand-*, so --p-primary-color stays on the BCC teal however the
documented ramps are set.

The split is not obvious from the outside: 16 component sections in the preset
read var(--color-*) and do follow the override — button, checkbox, radiobutton,
toggleswitch, select, listbox, multiselect, autocomplete, tag, datepicker, tabs,
stepper, badge, paginator, carousel, progressbar. Ten read {primary.*} and stay
teal — slider, rating, knob, datatable, treetable, tree, editor, timeline,
galleria, fileupload — as do --p-highlight-background and --p-highlight-color,
which colour selection in overlays.

Documents aliasing --p-color-brand-100..1000 to --color-brand-*. That is the
variable --p-primary-* actually resolves through, so the steps map one to one
and both colour schemes follow from the same ten lines, unlike restating
--p-primary-50..950 where the scales differ and dark mode picks a different step.

Recorded as a stopgap. The durable fix belongs in the preset: point
primitive.color.brand at the CSS variables instead of baking in values, and the
third ramp becomes redundant.

Verified in Chromium against rendered components, with the README snippet taken
verbatim: light gives #1d4ed8 on both a primary button and a slider range, dark
gives #bfdbfe, and without the override both stay teal.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LyYwdsJiGLEyRrJ6tVdnpK
@akselkvitberg

Copy link
Copy Markdown
Member Author

@u12206050 @jasverix

AI suggest to fix the third ramp in the Token repo. I leave that decision to you.

One change in bcc-code/bcc-tokens, where the preset is generated — make the primitive reference the CSS variables:

brand: { "100": "var(--color-brand-100)", … "1000": "var(--color-brand-1000)" }

Tested this by patching the installed preset and generating the theme through @primeuix/themes:

current:  --p-color-brand-800 = #014d49
patched:  --p-color-brand-800 = var(--color-brand-800)

--p-primary-color already resolves as var(--p-color-brand-800), so the whole chain — --p-primary-*, highlight, all 10 components — starts following --color-brand-*. Dark mode keeps working, because the light/dark schemes pick different steps of a ramp that is itself scheme-independent. No third ramp for consumers, and it removes the split entirely.

@akselkvitberg
akselkvitberg marked this pull request as ready for review September 22, 2026 08:43
@jasverix

Copy link
Copy Markdown
Collaborator

Can this also be documented in the LLM files, so an AI would easily find it?

@akselkvitberg

Copy link
Copy Markdown
Member Author

LLMs are covered - they are generated from the storybook files.

@jasverix jasverix left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated tokens in this branch.
Screenshot 2026-09-22 at 13-08-53

Now, --p-color-brand-100 resolves to var(--color-brand-100).

Update documentation accordingly, and then we'll merge.

…5.2.10

design-tokens 5.2.10 points primitive.color.brand at the CSS variables, so
--p-primary-* now follows --color-brand-* on its own. The --p-color-brand-*
workaround and its explanation are no longer needed, and the docs go back to two
ramps.

Verified against rendered components on 5.2.10 with the two-ramp README snippet:
a primary button and a slider range both give #1d4ed8 in light and #bfdbfe in
dark, where the slider previously stayed teal. --p-primary-color tracks the
override in both schemes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LyYwdsJiGLEyRrJ6tVdnpK
@jasverix
jasverix merged commit 00eac67 into main Sep 22, 2026
6 checks passed
@jasverix
jasverix deleted the claude/component-library-brand-colors-vmjb02 branch September 22, 2026 11:22
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.

4 participants