material.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. // @flow
  2. import color from 'color';
  3. import { Platform, Dimensions, PixelRatio } from 'react-native';
  4. import { PLATFORM } from './commonColor';
  5. const deviceHeight = Dimensions.get('window').height;
  6. const deviceWidth = Dimensions.get('window').width;
  7. const platform = Platform.OS;
  8. const platformStyle = PLATFORM.MATERIAL;
  9. const isIphoneX =
  10. platform === PLATFORM.IOS &&
  11. (deviceHeight === 812 ||
  12. deviceWidth === 812 ||
  13. deviceHeight === 896 ||
  14. deviceWidth === 896);
  15. export default {
  16. platformStyle,
  17. platform,
  18. // Accordion
  19. headerStyle: '#edebed',
  20. iconStyle: '#000',
  21. contentStyle: '#f5f4f5',
  22. expandedIconStyle: '#000',
  23. accordionBorderColor: '#d3d3d3',
  24. // ActionSheet
  25. elevation: 4,
  26. containerTouchableBackgroundColor: 'rgba(0,0,0,0.4)',
  27. innerTouchableBackgroundColor: '#fff',
  28. listItemHeight: 50,
  29. listItemBorderColor: 'transparent',
  30. marginHorizontal: -15,
  31. marginLeft: 14,
  32. marginTop: 15,
  33. minHeight: 56,
  34. padding: 15,
  35. touchableTextColor: '#757575',
  36. // Android
  37. androidRipple: true,
  38. androidRippleColor: 'rgba(256, 256, 256, 0.3)',
  39. androidRippleColorDark: 'rgba(0, 0, 0, 0.15)',
  40. buttonUppercaseAndroidText: true,
  41. // Badge
  42. badgeBg: '#ED1727',
  43. badgeColor: '#fff',
  44. badgePadding: 0,
  45. // Button
  46. buttonFontFamily: 'Roboto',
  47. buttonDisabledBg: '#b5b5b5',
  48. buttonPadding: 6,
  49. get buttonPrimaryBg() {
  50. return this.brandPrimary;
  51. },
  52. get buttonPrimaryColor() {
  53. return this.inverseTextColor;
  54. },
  55. get buttonInfoBg() {
  56. return this.brandInfo;
  57. },
  58. get buttonInfoColor() {
  59. return this.inverseTextColor;
  60. },
  61. get buttonSuccessBg() {
  62. return this.brandSuccess;
  63. },
  64. get buttonSuccessColor() {
  65. return this.inverseTextColor;
  66. },
  67. get buttonDangerBg() {
  68. return this.brandDanger;
  69. },
  70. get buttonDangerColor() {
  71. return this.inverseTextColor;
  72. },
  73. get buttonWarningBg() {
  74. return this.brandWarning;
  75. },
  76. get buttonWarningColor() {
  77. return this.inverseTextColor;
  78. },
  79. get buttonTextSize() {
  80. return this.fontSizeBase - 1;
  81. },
  82. get buttonTextSizeLarge() {
  83. return this.fontSizeBase * 1.5;
  84. },
  85. get buttonTextSizeSmall() {
  86. return this.fontSizeBase * 0.8;
  87. },
  88. get borderRadiusLarge() {
  89. return this.fontSizeBase * 3.8;
  90. },
  91. get iconSizeLarge() {
  92. return this.iconFontSize * 1.5;
  93. },
  94. get iconSizeSmall() {
  95. return this.iconFontSize * 0.6;
  96. },
  97. // Card
  98. cardDefaultBg: '#fff',
  99. cardBorderColor: '#ccc',
  100. cardBorderRadius: 2,
  101. cardItemPadding: platform === PLATFORM.IOS ? 10 : 12,
  102. // CheckBox
  103. CheckboxRadius: 0,
  104. CheckboxBorderWidth: 2,
  105. CheckboxPaddingLeft: 2,
  106. CheckboxPaddingBottom: 5,
  107. CheckboxIconSize: 16,
  108. CheckboxIconMarginTop: 1,
  109. CheckboxFontSize: 17,
  110. checkboxBgColor: '#039BE5',
  111. checkboxSize: 20,
  112. checkboxTickColor: '#fff',
  113. // Color
  114. brandPrimary: '#3F51B5',
  115. brandInfo: '#62B1F6',
  116. brandSuccess: '#5cb85c',
  117. brandDanger: '#d9534f',
  118. brandWarning: '#f0ad4e',
  119. brandDark: '#000',
  120. brandLight: '#f4f4f4',
  121. // Container
  122. containerBgColor: '#fff',
  123. // Date Picker
  124. datePickerTextColor: '#000',
  125. datePickerBg: 'transparent',
  126. // FAB
  127. fabWidth: 56,
  128. // Font
  129. DefaultFontSize: 16,
  130. fontFamily: 'Roboto',
  131. fontSizeBase: 15,
  132. get fontSizeH1() {
  133. return this.fontSizeBase * 1.8;
  134. },
  135. get fontSizeH2() {
  136. return this.fontSizeBase * 1.6;
  137. },
  138. get fontSizeH3() {
  139. return this.fontSizeBase * 1.4;
  140. },
  141. // Footer
  142. footerHeight: 55,
  143. footerDefaultBg: '#3F51B5',
  144. footerPaddingBottom: 0,
  145. // FooterTab
  146. tabBarTextColor: '#bfc6ea',
  147. tabBarTextSize: 11,
  148. activeTab: '#fff',
  149. sTabBarActiveTextColor: '#007aff',
  150. tabBarActiveTextColor: '#fff',
  151. tabActiveBgColor: '#3F51B5',
  152. // Header
  153. toolbarBtnColor: '#fff',
  154. toolbarDefaultBg: '#3F51B5',
  155. toolbarHeight: 56,
  156. toolbarSearchIconSize: 23,
  157. toolbarInputColor: '#fff',
  158. searchBarHeight: platform === PLATFORM.IOS ? 30 : 40,
  159. searchBarInputHeight: platform === PLATFORM.IOS ? 40 : 50,
  160. toolbarBtnTextColor: '#fff',
  161. toolbarDefaultBorder: '#3F51B5',
  162. iosStatusbar: 'light-content',
  163. get statusBarColor() {
  164. return color(this.toolbarDefaultBg)
  165. .darken(0.2)
  166. .hex();
  167. },
  168. get darkenHeader() {
  169. return color(this.tabBgColor)
  170. .darken(0.03)
  171. .hex();
  172. },
  173. // Icon
  174. iconFamily: 'Ionicons',
  175. iconFontSize: 28,
  176. iconHeaderSize: 24,
  177. // InputGroup
  178. inputFontSize: 17,
  179. inputBorderColor: '#D9D5DC',
  180. inputSuccessBorderColor: '#2b8339',
  181. inputErrorBorderColor: '#ed2f2f',
  182. inputHeightBase: 50,
  183. get inputColor() {
  184. return this.textColor;
  185. },
  186. get inputColorPlaceholder() {
  187. return '#575757';
  188. },
  189. // Line Height
  190. buttonLineHeight: 19,
  191. lineHeightH1: 32,
  192. lineHeightH2: 27,
  193. lineHeightH3: 22,
  194. lineHeight: 24,
  195. // List
  196. listBg: 'transparent',
  197. listBorderColor: '#c9c9c9',
  198. listDividerBg: '#f4f4f4',
  199. listBtnUnderlayColor: '#DDD',
  200. listItemPadding: 12,
  201. listNoteColor: '#808080',
  202. listNoteSize: 13,
  203. listItemSelected: '#3F51B5',
  204. // Progress Bar
  205. defaultProgressColor: '#E4202D',
  206. inverseProgressColor: '#1A191B',
  207. // Radio Button
  208. radioBtnSize: 23,
  209. radioSelectedColorAndroid: '#3F51B5',
  210. radioBtnLineHeight: 24,
  211. get radioColor() {
  212. return this.brandPrimary;
  213. },
  214. // Segment
  215. segmentBackgroundColor: '#3F51B5',
  216. segmentActiveBackgroundColor: '#fff',
  217. segmentTextColor: '#fff',
  218. segmentActiveTextColor: '#3F51B5',
  219. segmentBorderColor: '#fff',
  220. segmentBorderColorMain: '#3F51B5',
  221. // Spinner
  222. defaultSpinnerColor: '#45D56E',
  223. inverseSpinnerColor: '#1A191B',
  224. // Tab
  225. tabDefaultBg: '#3F51B5',
  226. topTabBarTextColor: '#b3c7f9',
  227. topTabBarActiveTextColor: '#fff',
  228. topTabBarBorderColor: '#fff',
  229. topTabBarActiveBorderColor: '#fff',
  230. // Tabs
  231. tabBgColor: '#F8F8F8',
  232. tabFontSize: 15,
  233. // Text
  234. textColor: '#000',
  235. inverseTextColor: '#fff',
  236. noteFontSize: 14,
  237. get defaultTextColor() {
  238. return this.textColor;
  239. },
  240. // Title
  241. titleFontfamily: 'Roboto',
  242. titleFontSize: 19,
  243. subTitleFontSize: 14,
  244. subtitleColor: '#FFF',
  245. titleFontColor: '#FFF',
  246. // Other
  247. borderRadiusBase: 2,
  248. borderWidth: 1 / PixelRatio.getPixelSizeForLayoutSize(1),
  249. contentPadding: 10,
  250. dropdownLinkColor: '#414142',
  251. inputLineHeight: 24,
  252. deviceWidth,
  253. deviceHeight,
  254. isIphoneX,
  255. inputGroupRoundedBorderRadius: 30,
  256. // iPhoneX SafeArea
  257. Inset: {
  258. portrait: {
  259. topInset: 24,
  260. leftInset: 0,
  261. rightInset: 0,
  262. bottomInset: 34
  263. },
  264. landscape: {
  265. topInset: 0,
  266. leftInset: 44,
  267. rightInset: 44,
  268. bottomInset: 21
  269. }
  270. }
  271. };