Appearance module exposes information about the user’s appearance preferences, such as their preferred color scheme (light or dark).
Methods
getColorScheme()
useColorScheme hook.
Returns:
'light'- Light color scheme is preferred'dark'- Dark color scheme is preferrednull- No preference or unable to determine
setColorScheme()
colorScheme: The color scheme to set'light'- Light mode'dark'- Dark mode'unspecified'- Use system default
addChangeListener()
listener: Function to call when the color scheme changes
EventSubscriptionobject with aremove()method to unsubscribe
Hook
For functional components, use theuseColorScheme hook instead:
Platform Differences
- iOS: Reflects the system-wide appearance setting from Settings > Display & Brightness
- Android: Reflects the system dark theme setting (Android 10+)
- Web: May reflect the browser/OS preference via
prefers-color-schememedia query