Skip to content

feat(theme): update base tokens to use light-dark() defaults - #140

Merged
cixzhang merged 1 commit into
mainfrom
navi/feat/tokens-light-dark
Feb 18, 2026
Merged

cixzhang merged 1 commit into
mainfrom
navi/feat/tokens-light-dark

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

Summary

Updates the base defineVars defaults in tokens.stylex.ts to use light-dark() CSS values so components work correctly in both light and dark mode without any theme applied.

This is a prerequisite for #139 (separating themes into their own package). The goal is that @xds/core is fully self-contained — consumers get a functional, dark-mode-aware UI just by importing components, no theme required.

Changes

packages/core/src/theme/tokens.stylex.ts

colorRaw — All 65 color tokens updated from single hex values to light-dark():

// Before
'--color-accent': '#0064E0',
'--color-surface': '#FFFFFF',
'--color-text-primary': '#0A1317',

// After
'--color-accent': 'light-dark(#0064E0, #2694FE)',
'--color-surface': 'light-dark(#FFFFFF, #1F1F22)',
'--color-text-primary': 'light-dark(#0A1317, #DFE2E5)',

elevationRaw — All 5 elevation tokens updated to use light-dark() for shadow colors:

// Before
'--elevation-base': '0px 0px 1px rgba(0, 0, 0, 0.1)',

// After
'--elevation-base': '0px 0px 1px light-dark(rgba(0, 0, 0, 0.1), #111112)',

--color-hover-tint — Updated from 'black' to 'light-dark(black, white)'

Not changed

  • spacingRaw, sizeRaw, radiusRaw, transitionRaw, typographyRaw, textSizeRaw, lineHeightRaw, fontWeightRaw — no light/dark variants needed
  • defineVars calls, type exports, as const annotations — all preserved
  • defaultTheme.stylex.ts — untouched (it already had light-dark() values)

Testing

  • All 59 runnable tests pass (same as main)
  • 35 pre-existing failures are react/jsx-dev-runtime missing module errors, unrelated

Related


Crafted with care by Navi

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 18, 2026
@cixzhang
cixzhang requested a review from mellyeliu February 18, 2026 21:45
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@xds/core 5.9KB 9.7KB 1.6KB

Accessibility Audit

Status: 43 accessibility violation(s) found.

XDSAspectRatio - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSAvatar - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSBadge - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSButton - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSCalendar - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSCard - 2 issue(s)
  • critical: Form elements must have labels
    • Rule: label
  • serious: Links must have discernible text
    • Rule: link-name
XDSCenter - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSCheckboxInput - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSCloseButton - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSDateInput - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSDialog - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSDivider - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSDropdownMenu - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSField - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSFontWrapper - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSGrid - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSHStack - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSHeading - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSHoverCard - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSIcon - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSLayout - 2 issue(s)
  • critical: Form elements must have labels
    • Rule: label
  • serious: Links must have discernible text
    • Rule: link-name
XDSLink - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSNumberInput - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSRadioList - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSSection - 2 issue(s)
  • critical: Form elements must have labels
    • Rule: label
  • serious: Links must have discernible text
    • Rule: link-name
XDSSelector - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSSkeleton - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSSlider - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSStackItem - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSSwitch - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSTabList - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSTable - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSText - 2 issue(s)
  • critical: Form elements must have labels
    • Rule: label
  • serious: Links must have discernible text
    • Rule: link-name
XDSTextArea - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSTextInput - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSTimeInput - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSTooltip - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSTopNav - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name
XDSVStack - 1 issue(s)
  • serious: Links must have discernible text
    • Rule: link-name

Generated by PR Enrichment workflow | Storybook | View full report

@cixzhang
cixzhang merged commit a9c3a3f into main Feb 18, 2026
5 checks passed
@cixzhang
cixzhang deleted the navi/feat/tokens-light-dark branch February 18, 2026 22:05
cixzhang added a commit that referenced this pull request Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant