Repository navigation
Description
Problem
XDSText (and XDSHeading, which shares the same color type) has no way to render text in the theme's accent text color. The color prop is typed as:
// packages/core/src/theme/types.ts
export type XDSTextColor =
| 'primary'
| 'secondary'
| 'disabled'
| 'placeholder'
| 'active'
| 'inherit';There's no 'accent' value. The closest option, 'active', maps to --color-accent (the accent surface/base color), not --color-text-accent (the dedicated accent text ink):
// packages/core/src/Text/text.stylex.ts
active: {
color: colorVars['--color-accent'],
},These are intentionally different tokens — --color-text-accent is tuned for legible accent-colored text (often a deeper/adjusted accent), while --color-accent is the interactive/base accent. So today there is no first-class, type-safe way to say "make this text the accent text color."
Why it matters
--color-text-accentexists precisely for accent-colored text, but no component prop exposes it — consumers can't use the design system's own accent-text token through the normalcolorAPI.- The only workaround is an
xstyle/inline override hardcodingcolor: 'var(--color-text-accent)', which bypasses the typedcolorprop, duplicates token knowledge at call sites, and is easy to get wrong (e.g. reaching foractiveand silently getting--color-accentinstead). - Accent-colored headings/links/labels are a common need (hero headlines, callouts, emphasized inline text).
Concrete example
Setting a hero headline to the accent text ink currently requires:
const styles = stylex.create({
accentText: {color: 'var(--color-text-accent)'},
});
<XDSText type="display-3" xstyle={styles.accentText}>Little joys</XDSText>Desired:
<XDSText type="display-3" color="accent">Little joys</XDSText>
<XDSHeading level={2} color="accent">Section</XDSHeading>(This came up while theming the docsite theme-showcase hero headline, which had to fall back to an xstyle override for exactly this reason.)
Proposed change
Add an 'accent' value to XDSTextColor that maps to --color-text-accent:
packages/core/src/theme/types.ts— add'accent'to theXDSTextColorunion.packages/core/src/Text/text.stylex.ts— add anaccententry tocolorStyles→colorVars['--color-text-accent'].XDSText+XDSHeadingpick it up automatically (both already acceptcolor?: XDSTextColor).- Docs: update
Text.doc.mjs/Heading.doc.mjscolor tables.
Open questions
- Naming:
'accent'(maps to--color-text-accent) reads naturally, but note the existing'active'already maps to--color-accent. Worth documenting the distinction clearly, or reconsidering whether'active'should point at--color-text-accent(likely a breaking change — probably keep'active'as-is and add'accent'). - Should categorical text colors (
--color-text-blue,-green, etc.) also be exposed eventually? Out of scope here, but the same gap exists.
Accessibility
--color-text-accent is the token designed for accent-colored text, so this nudges consumers toward the mode-correct, contrast-tuned value instead of hardcoding --color-accent (which is not guaranteed to meet text-contrast on body surfaces in every theme).
References
packages/core/src/theme/types.ts—XDSTextColorunion (noaccent)packages/core/src/Text/text.stylex.ts—colorStyles(active→--color-accent)packages/core/src/Text/XDSText.tsx/packages/core/src/Heading/XDSHeading.tsx— both usecolor?: XDSTextColor
Activity
cixzhang commentedon Jun 28, 2026
We do have something like color link internally for better accessible link colors so this could make sense.
I think the non semantic color text towns are already there.
feat(core): rename Text 'active' color to 'accent' mapped to --color-…