Decouple @primer/react ThemeProvider from legacy color-scheme merging while preserving @primer/styled-react#8193
Closed
mattcosta7 with Copilot wants to merge 2 commits into
Closed
Decouple @primer/react ThemeProvider from legacy color-scheme merging while preserving @primer/styled-react#8193mattcosta7 with Copilot wants to merge 2 commits into
@primer/react ThemeProvider from legacy color-scheme merging while preserving @primer/styled-react#8193mattcosta7 with Copilot wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 50b90b5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…@primer/react Co-authored-by: mattcosta7 <8616962+mattcosta7@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Remove heavy legacy-theme objects from ThemeProvider
Decouple Jul 18, 2026
@primer/react ThemeProvider from legacy color-scheme merging while preserving @primer/styled-react
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
@primer/reactno longer resolves legacy color schemes in its ThemeProvider path and no longer exportstheme.colorSchemes, removing the heavy legacy-theme object from main runtime/export paths. Legacy color-scheme resolution remains intact in@primer/styled-react.New
@primer/reactnow exposes a legacy subpath export for styled-react compatibility:@primer/react/legacy-theme/ts/color-schemesChanged
@primer/reactThemeProvider runtime pathapplyColorScheme+deepmergeusage frompackages/react/src/ThemeProvider.tsxthemeobject (no color-scheme deep merge)resolvedColorMode,colorScheme, mode/scheme setters,contextOnly, anddata-*attributes remain unchanged@primer/reacttheme export shapecolorSchemesfrompackages/react/src/theme.tsthemeexport no longer pulls inlegacy-theme/ts/color-schemes@primer/styled-reactcompatibility pathThemeProvidernow imports legacycolorSchemesdirectly and reconstructs default theme for legacy resolution behavior:Removed
@primer/reactThemeProvider/useTheme path:resolvedColorSchemeinThemeContextshapeuseTheme().resolvedColorSchemebehavior/docs/testsRollout strategy
Migration plan (draft PR):
major) with explicit release-note callouts:useTheme().resolvedColorSchemeremoved from@primer/reacttheme.colorSchemesremoved from@primer/reactdefault theme export@primer/styled-react(which continues to resolve color schemes) or import the legacy subpath explicitly.Testing & Reviewing
packages/react/src/ThemeProvider.tsxpackages/react/src/theme.tspackages/styled-react/src/components/ThemeProvider.tsx@primer/reactno longer carries legacy color-scheme resolution in ThemeProvider context while@primer/styled-reactbehavior remains unchanged for existing tests/consumers.