Version: 3.0.7

useContrastText

useContrastText is a custom hook used to get a contrasting color (either lightText or darkText) to the color passed as a parameter.

Import#

import { useContrastText } from 'native-base';

Examples#

Basic#

Using Accessible Colors#

By default, NativeBase provides contrasting color based on its theme. You can also choose to get color with better color and contrast accessibility with the help of useAccessibleColors hook.

Return value#

Accepts and returns a color defined in the theme.