shipwreckt.py (4575B)
1 from ranger.gui.colorscheme import ColorScheme 2 from ranger.gui.color import default_colors, reverse, bold, normal, default 3 4 class Shipwreckt(ColorScheme): 5 progress_bar_color = 108 6 7 def use(self, context): 8 fg, bg, attr = default_colors 9 10 if context.reset: 11 return default_colors 12 13 elif context.in_browser: 14 if context.selected: 15 attr = reverse 16 else: 17 attr = normal 18 if context.empty or context.error: 19 fg = 174 20 bg = 235 21 if context.border: 22 fg = 61 23 if context.image: 24 fg = 31 25 if context.video: 26 fg = 160 27 if context.audio: 28 fg = 124 29 if context.document: 30 fg = 31 31 if context.container: 32 attr |= bold 33 fg = 174 34 if context.directory: 35 attr |= bold 36 fg = 61 37 elif context.executable and not \ 38 any((context.media, context.container, 39 context.fifo, context.socket)): 40 attr |= bold 41 fg = 108 42 if context.socket: 43 fg = 180 44 attr |= bold 45 if context.fifo or context.device: 46 fg = 144 47 if context.device: 48 attr |= bold 49 if context.link: 50 fg = 223 if context.good else 116 51 bg = 234 52 if context.bad: 53 bg = 235 54 if context.tag_marker and not context.selected: 55 attr |= bold 56 if fg in (174, 95): 57 fg = 248 58 else: 59 fg = 174 60 if not context.selected and (context.cut or context.copied): 61 fg = 108 62 bg = 234 63 if context.main_column: 64 if context.selected: 65 attr |= bold 66 if context.marked: 67 attr |= bold 68 fg = 223 69 if context.badinfo: 70 if attr & reverse: 71 bg = 95 72 else: 73 fg = 95 74 75 elif context.in_titlebar: 76 attr |= bold 77 if context.hostname: 78 fg = 93 79 elif context.directory: 80 fg = 61 81 elif context.tab: 82 if context.good: 83 bg = 180 84 elif context.link: 85 fg = 116 86 87 elif context.in_statusbar: 88 if context.permissions: 89 if context.good: 90 fg = 108 91 elif context.bad: 92 fg = 174 93 if context.marked: 94 attr |= bold | reverse 95 fg = 223 96 if context.message: 97 if context.bad: 98 attr |= bold 99 fg = 174 100 if context.loaded: 101 bg = self.progress_bar_color 102 if context.vcsinfo: 103 fg = 116 104 attr &= ~bold 105 if context.vcscommit: 106 fg = 144 107 attr &= ~bold 108 109 if context.text: 110 if context.highlight: 111 attr |= reverse 112 113 if context.in_taskview: 114 if context.title: 115 fg = 116 116 117 if context.selected: 118 attr |= reverse 119 120 if context.loaded: 121 if context.selected: 122 fg = self.progress_bar_color 123 else: 124 bg = self.progress_bar_color 125 126 if context.vcsfile and not context.selected: 127 attr &= ~bold 128 if context.vcsconflict: 129 fg = 95 130 elif context.vcschanged: 131 fg = 174 132 elif context.vcsunknown: 133 fg = 174 134 elif context.vcsstaged: 135 fg = 108 136 elif context.vcssync: 137 fg = 108 138 elif context.vcsignored: 139 fg = default 140 141 elif context.vcsremote and not context.selected: 142 attr &= ~bold 143 if context.vcssync: 144 fg = 108 145 elif context.vcsbehind: 146 fg = 174 147 elif context.vcsahead: 148 fg = 116 149 elif context.vcsdiverged: 150 fg = 95 151 elif context.vcsunknown: 152 fg = 174 153 154 return fg, bg, attr