Skip to main content

Platform Colors

React Native macOS extends the core PlatformColor API with helpers that map directly to AppKit system colors. These helpers make it easier to adopt macOS appearance and accessibility behaviors without writing native code.

DynamicColorMacOS

DynamicColorMacOS creates a color that automatically adapts to light, dark, and high-contrast appearances on macOS.

note

DynamicColorIOS works on macOS too, they are essentially equivalent

OptionDescription
lightColor used in the standard light appearance.
darkColor used in the standard dark appearance.
highContrastLightOptional color for high-contrast light mode. Defaults to light.
highContrastDarkOptional color for high-contrast dark mode. Defaults to dark.

ColorWithSystemEffectMacOS

ColorWithSystemEffectMacOS(color, effect) wraps an existing color so AppKit can apply control state effects such as pressed, disabled, or rollover.

ParameterDescription
colorA string produced by PlatformColor, DynamicColorMacOS, or a CSS color string.
effectOne of none, pressed, deepPressed, disabled, or rollover.
import {
ColorWithSystemEffectMacOS,
DynamicColorMacOS,
PlatformColor,
StyleSheet,
} from 'react-native';

const styles = StyleSheet.create({
buttonPressed: {
backgroundColor: ColorWithSystemEffectMacOS(
PlatformColor('controlColor'),
'pressed',
),
},
});