Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
5.4 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. # This file is part of ranger, the console file manager.
  2. # License: GNU GPL version 3, see the file "AUTHORS" for details.
  3. from __future__ import (absolute_import, division, print_function)
  4. from ranger.gui.colorscheme import ColorScheme
  5. from ranger.gui.color import (
  6. default, normal, bold, reverse, dim, BRIGHT, default_colors,
  7. )
  8. black = 16
  9. blue = 32
  10. cyan = 50
  11. green = 47
  12. magenta = 141
  13. red = 9
  14. white = 255
  15. yellow =227
  16. class Default(ColorScheme):
  17. progress_bar_color = 87
  18. def use(self, context): # pylint: disable=too-many-branches,too-many-statements
  19. fg, bg, attr = 231, black, bold
  20. if context.reset:
  21. return default_colors
  22. elif context.in_browser:
  23. if context.selected:
  24. attr = reverse
  25. else:
  26. attr = normal
  27. if context.empty or context.error:
  28. bg = red
  29. if context.border:
  30. fg = default
  31. if context.media:
  32. if context.image:
  33. fg = yellow
  34. else:
  35. fg = magenta
  36. if context.container:
  37. fg = red
  38. if context.directory:
  39. attr |= bold
  40. fg = blue
  41. elif context.executable and not \
  42. any((context.media, context.container,
  43. context.fifo, context.socket)):
  44. attr |= bold
  45. fg = green
  46. if context.socket:
  47. attr |= bold
  48. fg = magenta
  49. if context.fifo or context.device:
  50. fg = yellow
  51. if context.device:
  52. attr |= bold
  53. if context.link:
  54. fg = cyan if context.good else magenta
  55. if context.tag_marker and not context.selected:
  56. attr |= bold
  57. if fg in (red, magenta):
  58. fg = white
  59. else:
  60. fg = red
  61. if not context.selected and (context.cut or context.copied):
  62. attr |= bold
  63. fg = black
  64. # If the terminal doesn't support bright colors, use dim white
  65. # instead of black.
  66. if BRIGHT == 0:
  67. attr |= dim
  68. fg = white
  69. if context.main_column:
  70. # Doubling up with BRIGHT here causes issues because it's
  71. # additive not idempotent.
  72. if context.selected:
  73. attr |= bold
  74. if context.marked:
  75. attr |= bold
  76. fg = yellow
  77. if context.badinfo:
  78. if attr & reverse:
  79. bg = magenta
  80. else:
  81. fg = magenta
  82. if context.inactive_pane:
  83. fg = cyan
  84. elif context.in_titlebar:
  85. if context.hostname:
  86. fg = red if context.bad else green
  87. elif context.directory:
  88. fg = blue
  89. elif context.tab:
  90. if context.good:
  91. bg = green
  92. elif context.link:
  93. fg = cyan
  94. attr |= bold
  95. elif context.in_statusbar:
  96. if context.permissions:
  97. if context.good:
  98. fg = cyan
  99. elif context.bad:
  100. fg = magenta
  101. if context.marked:
  102. attr |= bold | reverse
  103. fg = yellow
  104. if context.frozen:
  105. attr |= bold | reverse
  106. fg = cyan
  107. if context.message:
  108. if context.bad:
  109. attr |= bold
  110. fg = red
  111. if context.loaded:
  112. bg = self.progress_bar_color
  113. if context.vcsinfo:
  114. fg = blue
  115. attr &= ~bold
  116. if context.vcscommit:
  117. fg = yellow
  118. attr &= ~bold
  119. if context.vcsdate:
  120. fg = cyan
  121. attr &= ~bold
  122. if context.text:
  123. if context.highlight:
  124. attr |= reverse
  125. if context.in_taskview:
  126. if context.title:
  127. fg = blue
  128. if context.selected:
  129. attr |= reverse
  130. if context.loaded:
  131. if context.selected:
  132. fg = self.progress_bar_color
  133. else:
  134. bg = self.progress_bar_color
  135. if context.vcsfile and not context.selected:
  136. attr &= ~bold
  137. if context.vcsconflict:
  138. fg = magenta
  139. elif context.vcsuntracked:
  140. fg = cyan
  141. elif context.vcschanged:
  142. fg = red
  143. elif context.vcsunknown:
  144. fg = red
  145. elif context.vcsstaged:
  146. fg = green
  147. elif context.vcssync:
  148. fg = green
  149. elif context.vcsignored:
  150. fg = default
  151. elif context.vcsremote and not context.selected:
  152. attr &= ~bold
  153. if context.vcssync or context.vcsnone:
  154. fg = green
  155. elif context.vcsbehind:
  156. fg = red
  157. elif context.vcsahead:
  158. fg = blue
  159. elif context.vcsdiverged:
  160. fg = magenta
  161. elif context.vcsunknown:
  162. fg = red
  163. return fg, bg, attr