UNPKG

294 BTypeScriptView Raw
1import type { ColorValue } from 'react-native';
2import color from 'color';
3
4export default function getContrastingColor(
5 input: ColorValue,
6 light: string,
7 dark: string
8): string {
9 if (typeof input === 'string') {
10 return color(input).isLight() ? dark : light;
11 }
12
13 return light;
14}