Theme.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import {Appearance} from 'react-native';
  2. const themeDark = {
  3. dark: true,
  4. iosBarStyle: 'light-content',
  5. colors: {
  6. primary: '#111827',
  7. textOnPrimary: '#6B7280',
  8. background: '#000000',
  9. toolbarBorder: '#1F2937',
  10. text: '#6B7280',
  11. drawerBackground: '#f3f4f5',
  12. drawerText: '#1890ff',
  13. statusBar: '#000000',
  14. activityIndicator: '#6B7280',
  15. searchInputBackground: '#000000',
  16. searchInputBorder: '#1F2937',
  17. searchInputText: '#6B7280',
  18. searchInputPlaceholderText: '#8F9BB3',
  19. }
  20. };
  21. const themeLight = {
  22. dark: false,
  23. iosBarStyle: 'dark-content',
  24. colors: {
  25. primary: '#fff',
  26. textOnPrimary: '#6B7280',
  27. background: '#F3F4F6',
  28. toolbarBorder: '#E4E9F2',
  29. text: '#6B7280',
  30. drawerBackground: '#F3F4F6',
  31. drawerText: '#6B7280',
  32. statusBar: '#fff',
  33. activityIndicator: '#6B7280',
  34. searchInputBackground: '#F7F9FC',
  35. searchInputBorder: '#E4E9F2',
  36. searchInputText: '#6B7280',
  37. searchInputPlaceholderText: '#8F9BB3',
  38. }
  39. };
  40. function useTheme (s) {
  41. var colorScheme = Appearance.getColorScheme();
  42. var a = s.split('.'),
  43. ret = 'dark' === colorScheme ? themeDark : themeLight,
  44. i = 0;
  45. for (; i < a.length ; i++) {
  46. if ('undefined' !== typeof(ret[a[i]]))
  47. ret = ret[a[i]];
  48. }
  49. return ret;
  50. }
  51. export {themeDark, themeLight, useTheme};