import { Dimensions, Platform } from 'react-native' export const keys = ['white', 'black'] export const langs = ['zh-Hans-US', 'en'] // 适配IphoneX export const isIphoneX = () => { let dimen = Dimensions.get('window') return ( Platform.OS === 'ios' && !Platform.isPad && !Platform.isTVOS && (dimen.height === 812 || dimen.width === 812) ) } export default class AppTheme { static colorMap = {} static switchTheme = (map = keys[1]) => { return AppTheme.colorMap[map] } static setTheme = theme => { return (AppTheme.currentMap = theme) } //Index map for memr static currentMap static currentTheme = keys[1] } AppTheme.colorMap[keys[0]] = { describeText: 'white', barStyle: 'dark-content', backgroundColor: '#F7F7F7', // defImgs:{ // userPhoto:defUserPhotoWhite, // prodImg:defProductImgWhite, // logo:logoWhite, // background:bgWhite, // }, header: { backgroundColor: '#E14C46', color: '#fff', }, tabBar: { backgroundColor: 'rgba(255,255,255,.9)', color: '#666', colorActive: '#E14C46', borderColor: '#eee', }, normal: { title1: { color: '#333', }, title2: { color: '#555', }, title3: { color: '#666', }, item1: { backgroundColor: '#fffffc', }, item2: { backgroundColor: '#fff', }, border1: { color: '#eee', }, border2: { color: '#ddd', }, border3: { color: '#ddd', }, }, modal: { title1: { color: '#333', }, title2: { color: '#ccc', }, border1: { color: '#ddd', }, border2: { color: '#ccc', }, }, extra: { red: { color: '#E14C46', }, yellow: { color: '#FAAF1E', }, blue: { color: '#0090D5', }, green: { color: '#59C152', }, purple: { color: '#A856F8', }, white: { color: '#fff', }, black: { color: '#333', }, coffee: { color: 'rgba(250,175,30,0.50)', }, brown: { color: 'rgba(225,76,70,0.50)', }, }, } AppTheme.colorMap[keys[1]] = { describeText: 'black', barStyle: 'light-content', backgroundColor: '#1C1F2C', // defImgs:{ // userPhoto:defUserPhotoWhite, // prodImg:defProductImg, // logo:logoBlack, // background:bgBlack, // }, header: { backgroundColor: '#12141C', color: '#fff', }, tabBar: { backgroundColor: '#12141C', color: '#CFD2E6', colorActive: '#E14C46', borderColor: 'rgba(255,255,255,.1)', }, normal: { title1: { color: '#fff', }, title2: { color: '#CFD2E6', }, title3: { color: '#8A8C99', }, item1: { backgroundColor: '#262935', }, item2: { backgroundColor: '#232632', }, border1: { color: 'rgba(255,255,255,.1)', }, border2: { color: 'rgba(255,255,255,.2)', }, border3: { color: 'rgba(255,255,255,.5)', }, }, modal: { title1: { color: '#333', }, title2: { color: '#ccc', }, border1: { color: '#ddd', }, border2: { color: '#ccc', }, }, extra: { red: { color: '#E14C46', }, yellow: { color: '#FAAF1E', }, blue: { color: '#0090D5', }, green: { color: '#59C152', }, purple: { color: '#A856F8', }, white: { color: '#fff', }, black: { color: '#333', }, coffee: { color: 'rgba(250,175,30,0.50)', }, brown: { color: 'rgba(225,76,70,0.50)', }, }, } AppTheme.currentMap = AppTheme.switchTheme()