1import { ColorValue, Platform, processColor } from 'react-native'; 2 3import ExpoSystemUI from './ExpoSystemUI'; 4 5/** 6 * Changes the root view background color. 7 * 8 * @example 9 * ```ts 10 * SystemUI.setBackgroundColorAsync("white"); 11 * ``` 12 * @param color Any valid [CSS 3 (SVG) color](http://www.w3.org/TR/css3-color/#svg-color). 13 */ 14export async function setBackgroundColorAsync(color: ColorValue): Promise<void> { 15 const colorNumber = Platform.OS === 'web' ? color : processColor(color); 16 return await ExpoSystemUI.setBackgroundColorAsync(colorNumber); 17} 18 19/** 20 * Gets the root view background color. 21 * 22 * @example 23 * ```ts 24 * const color = await SystemUI.getBackgroundColorAsync(); 25 * ``` 26 * @returns Current root view background color in hex format. Returns `null` if the background color is not set. 27 */ 28export async function getBackgroundColorAsync(): Promise<ColorValue | null> { 29 return await ExpoSystemUI.getBackgroundColorAsync(); 30} 31