config.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. import { Dimensions, Platform } from 'react-native'
  2. export const keys = ['white', 'black']
  3. export const langs = ['zh-Hans-US', 'en']
  4. // 适配IphoneX
  5. export const isIphoneX = () => {
  6. let dimen = Dimensions.get('window')
  7. return (
  8. Platform.OS === 'ios' &&
  9. !Platform.isPad &&
  10. !Platform.isTVOS &&
  11. (dimen.height === 812 || dimen.width === 812)
  12. )
  13. }
  14. export default class AppTheme {
  15. static colorMap = {}
  16. static switchTheme = (map = keys[1]) => {
  17. return AppTheme.colorMap[map]
  18. }
  19. static setTheme = theme => {
  20. return (AppTheme.currentMap = theme)
  21. }
  22. //Index map for memr
  23. static currentMap
  24. static currentTheme = keys[1]
  25. }
  26. AppTheme.colorMap[keys[0]] = {
  27. describeText: 'white',
  28. barStyle: 'dark-content',
  29. backgroundColor: '#F7F7F7',
  30. // defImgs:{
  31. // userPhoto:defUserPhotoWhite,
  32. // prodImg:defProductImgWhite,
  33. // logo:logoWhite,
  34. // background:bgWhite,
  35. // },
  36. header: {
  37. backgroundColor: '#E14C46',
  38. color: '#fff',
  39. },
  40. tabBar: {
  41. backgroundColor: 'rgba(255,255,255,.9)',
  42. color: '#666',
  43. colorActive: '#E14C46',
  44. borderColor: '#eee',
  45. },
  46. normal: {
  47. title1: {
  48. color: '#333',
  49. },
  50. title2: {
  51. color: '#555',
  52. },
  53. title3: {
  54. color: '#666',
  55. },
  56. item1: {
  57. backgroundColor: '#fffffc',
  58. },
  59. item2: {
  60. backgroundColor: '#fff',
  61. },
  62. border1: {
  63. color: '#eee',
  64. },
  65. border2: {
  66. color: '#ddd',
  67. },
  68. border3: {
  69. color: '#ddd',
  70. },
  71. },
  72. modal: {
  73. title1: {
  74. color: '#333',
  75. },
  76. title2: {
  77. color: '#ccc',
  78. },
  79. border1: {
  80. color: '#ddd',
  81. },
  82. border2: {
  83. color: '#ccc',
  84. },
  85. },
  86. extra: {
  87. red: {
  88. color: '#E14C46',
  89. },
  90. yellow: {
  91. color: '#FAAF1E',
  92. },
  93. blue: {
  94. color: '#0090D5',
  95. },
  96. green: {
  97. color: '#59C152',
  98. },
  99. purple: {
  100. color: '#A856F8',
  101. },
  102. white: {
  103. color: '#fff',
  104. },
  105. black: {
  106. color: '#333',
  107. },
  108. coffee: {
  109. color: 'rgba(250,175,30,0.50)',
  110. },
  111. brown: {
  112. color: 'rgba(225,76,70,0.50)',
  113. },
  114. },
  115. }
  116. AppTheme.colorMap[keys[1]] = {
  117. describeText: 'black',
  118. barStyle: 'light-content',
  119. backgroundColor: '#1C1F2C',
  120. // defImgs:{
  121. // userPhoto:defUserPhotoWhite,
  122. // prodImg:defProductImg,
  123. // logo:logoBlack,
  124. // background:bgBlack,
  125. // },
  126. header: {
  127. backgroundColor: '#12141C',
  128. color: '#fff',
  129. },
  130. tabBar: {
  131. backgroundColor: '#12141C',
  132. color: '#CFD2E6',
  133. colorActive: '#E14C46',
  134. borderColor: 'rgba(255,255,255,.1)',
  135. },
  136. normal: {
  137. title1: {
  138. color: '#fff',
  139. },
  140. title2: {
  141. color: '#CFD2E6',
  142. },
  143. title3: {
  144. color: '#8A8C99',
  145. },
  146. item1: {
  147. backgroundColor: '#262935',
  148. },
  149. item2: {
  150. backgroundColor: '#232632',
  151. },
  152. border1: {
  153. color: 'rgba(255,255,255,.1)',
  154. },
  155. border2: {
  156. color: 'rgba(255,255,255,.2)',
  157. },
  158. border3: {
  159. color: 'rgba(255,255,255,.5)',
  160. },
  161. },
  162. modal: {
  163. title1: {
  164. color: '#333',
  165. },
  166. title2: {
  167. color: '#ccc',
  168. },
  169. border1: {
  170. color: '#ddd',
  171. },
  172. border2: {
  173. color: '#ccc',
  174. },
  175. },
  176. extra: {
  177. red: {
  178. color: '#E14C46',
  179. },
  180. yellow: {
  181. color: '#FAAF1E',
  182. },
  183. blue: {
  184. color: '#0090D5',
  185. },
  186. green: {
  187. color: '#59C152',
  188. },
  189. purple: {
  190. color: '#A856F8',
  191. },
  192. white: {
  193. color: '#fff',
  194. },
  195. black: {
  196. color: '#333',
  197. },
  198. coffee: {
  199. color: 'rgba(250,175,30,0.50)',
  200. },
  201. brown: {
  202. color: 'rgba(225,76,70,0.50)',
  203. },
  204. },
  205. }
  206. AppTheme.currentMap = AppTheme.switchTheme()