Skip to content

fix(fabric): colors not respecting dark mode appearance, implement platform color#2867

Open
Saadnajmi wants to merge 7 commits intomicrosoft:mainfrom
Saadnajmi:fabric-dark-mode-colors-fix
Open

fix(fabric): colors not respecting dark mode appearance, implement platform color#2867
Saadnajmi wants to merge 7 commits intomicrosoft:mainfrom
Saadnajmi:fabric-dark-mode-colors-fix

Conversation

@Saadnajmi
Copy link
Collaborator

@Saadnajmi Saadnajmi commented Mar 22, 2026

Summary

  • Fix Fabric renderer not resolving dynamic/semantic colors against the current macOS appearance, causing all colors to render as light mode regardless of system setting (fixes [0.81] Fabric colors don't respect current appearance #2830)
  • Add complete macOS semantic color dictionary to Fabric (label, text, content, control, window colors, etc.) with Swift-style aliases and fallback support
  • Add ColorWithSystemEffect support (pressed, disabled, rollover) to Fabric renderer
  • Add macOS section to PlatformColorExample and a Playground test page for dark mode color verification
Screenshot 2026-03-21 at 7 30 57 PM

Test plan

  • Built and ran RNTester-macOS with Fabric (new arch) enabled
  • Verified system colors, semantic colors, DynamicColorMacOS, and ColorWithSystemEffect all respect dark mode
  • Verified colors update correctly when toggling between Light and Dark appearance
  • Verified iOS build is not affected (macOS changes are behind TARGET_OS_OSX guards)
  • Verified visionOS build is not affected

🤖 Generated with Claude Code

Saadnajmi and others added 2 commits March 21, 2026 17:57
Resolve dynamic/semantic colors against the current effective appearance
on macOS so that dark mode colors are correctly extracted in the Fabric
renderer.

Fixes microsoft#2830

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add complete macOS semantic color dictionary (label, text, content,
control, window colors etc.) and ColorWithSystemEffect support from
PR microsoft#2737. Includes Swift-style aliases, fallback colors, array-based
color selectors, and PlatformColorExample for RNTester.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Saadnajmi Saadnajmi requested a review from a team as a code owner March 22, 2026 01:06
@changeset-bot
Copy link

changeset-bot bot commented Mar 22, 2026

⚠️ No Changeset found

Latest commit: f1400a0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Saadnajmi Saadnajmi changed the title fix(macos): Fabric colors not respecting dark mode appearance fix(fabric): Fabric colors not respecting dark mode appearance, implement platform color Mar 22, 2026
- Fix bare #endif to use proper #endif // macOS] tags per conventions
- Revert Playground and testerStateUtils to upstream defaults (test-only)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- RCTViewComponentView.mm: RCTUIView.updateLayer already resolves
  dynamic colors via .CGColor when AppKit calls it with the correct
  appearance context
- PlatformColorExample.js: macOS platform color examples already exist
  in Paper renderer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Saadnajmi and others added 2 commits March 21, 2026 20:58
- Fix #else/#endif comment tags to follow diffs-with-upstream guide
- Flip all macOS-first (#if TARGET_OS_OSX) blocks with #else to iOS-first
- Remove unnecessary TargetConditionals.h and AppKit.h imports
- Add back missing [macOS] tags on modified lines

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
No platform/macos directory exists since all code is inline in
platform/ios with #if TARGET_OS_OSX guards.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace manual NSAppearance save/restore with the cleaner
performAsCurrentDrawingAppearance API (available since macOS 11.0,
our min target is 14.0). This is exception-safe and more readable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Saadnajmi Saadnajmi changed the title fix(fabric): Fabric colors not respecting dark mode appearance, implement platform color fix(fabric): colors not respecting dark mode appearance, implement platform color Mar 23, 2026
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.

[0.81] Fabric colors don't respect current appearance

2 participants