useContrastText | NativeBase | Universal Components for React and React Native

Search
K
Hire us
Please opt in to our enterprise plan (coming soon) for priority support with NativeBase. If you are starting a new project, we recommend using gluestack-ui. For your existing projects, you can utilize @gluestack-ui/themed-native-base (beta).
useContrastText
useContrastText is a custom hook used to get a contrasting color (either lightText or darkText) to the color passed as a parameter.
Import
Copy
import { useContrastText } from 'native-base';
Examples
Basic
Playground
Using Accessible Colors
By default, NativeBase provides contrasting colors based on its theme. You can also choose to get colors with better with the help of hook.
Playground
Return value
Accepts and returns a color defined in the theme.
Nativebase logo
MadeWithNativeBase