1import {useTheme, Theme} from '@react-navigation/native'; 2 3type IColors = Theme['colors']; 4 5interface CustomizedColors extends IColors { 6 /** 二级颜色 */ 7 secondary?: string; 8 /** 普通文字 */ 9 text: string; 10 /** 副标题文字颜色 */ 11 textSecondary?: string; 12 /** 高亮文本颜色 */ 13 textHighlight?: string; 14 /** 背景高亮颜色 */ 15 backgroundHighlight?: string; 16 /** 页面背景 */ 17 pageBackground?: string; 18 /** 阴影 */ 19 shadow?: string; 20 /** 音乐栏颜色 */ 21 musicBar?: string; 22 /** 分割线 */ 23 divider?: string; 24 /** 标题字体,和primary对比的字体 */ 25 headerText?: string; 26 /** 高亮颜色 */ 27 listActive?: string; 28 /** 输入框背景色 */ 29 placeholder?: string; 30} 31 32export default function useColors() { 33 const {colors} = useTheme(); 34 35 return colors as CustomizedColors; 36} 37