scripts/themes/hgtk.py

156 lines
2.8 KiB
Python

from ranger.gui.colorscheme import ColorScheme
from ranger.gui.color import *
class Hirogaritakaku(ColorScheme):
progress_bar_color = blue
def use(self, ctx):
fg, bg, attr = default_colors
if ctx.reset:
pass
elif ctx.in_browser:
if ctx.selected:
attr = reverse
else:
attr = normal
if ctx.empty or ctx.error:
bg = red
if ctx.border:
fg = 141
if ctx.media:
if ctx.image:
fg = 170
else:
fg = 129
if ctx.container:
fg = 160
if ctx.directory:
attr |= bold
fg = 69
elif ctx.executable and not \
any((ctx.media, ctx.container,
ctx.fifo, ctx.socket)):
attr |= bold
fg = 46
if ctx.socket:
attr |= bold
fg = 154
if ctx.fifo:
fg = 190
if ctx.device:
attr |= bold
fg = 226
if ctx.link:
fg = 111 if ctx.good else 196
if ctx.tag_marker and not ctx.selected:
attr |= bold
fg = white
if not ctx.selected and (ctx.cut or ctx.copied):
attr |= bold
fg = black
if ctx.main_column:
if ctx.selected:
attr |= bold
if ctx.marked:
attr |= bold
fg = yellow
if ctx.badinfo:
if attr & reverse:
bg = magenta
else:
fg = magenta
if ctx.inactive_pane:
fg = cyan
elif ctx.in_titlebar:
if ctx.hostname:
fg = red if ctx.bad else green
elif ctx.directory:
fg = blue
elif ctx.tab:
if ctx.good:
bg = green
elif ctx.link:
fg = cyan
attr |= bold
elif ctx.in_statusbar:
if ctx.permissions:
if ctx.good:
fg = cyan
elif ctx.bad:
fg = magenta
if ctx.marked:
attr |= bold | reverse
fg = yellow
if ctx.frozen:
attr |= bold | reverse
fg = cyan
if ctx.message:
if ctx.bad:
attr |= bold
fg = red
if ctx.loaded:
bg = self.progress_bar_color
if ctx.vcsinfo:
fg = blue
attr &= ~bold
if ctx.vcscommit:
fg = yellow
attr &= ~bold
if ctx.vcsdate:
fg = cyan
attr &= ~bold
if ctx.text:
if ctx.highlight:
attr |= reverse
if ctx.in_taskview:
if ctx.title:
fg = blue
if ctx.selected:
attr |= reverse
if ctx.loaded:
if ctx.selected:
fg = self.progress_bar_color
else:
bg = self.progress_bar_color
if ctx.vcsfile and not ctx.selected:
attr &= ~bold
if ctx.vcsconflict:
fg = magenta
elif ctx.vcsuntracked:
fg = cyan
elif ctx.vcschanged:
fg = red
elif ctx.vcsunknown:
fg = red
elif ctx.vcsstaged:
fg = green
elif ctx.vcssync:
fg = green
elif ctx.vcsignored:
fg = default
elif ctx.vcsremote and not ctx.selected:
attr &= ~bold
if ctx.vcssync or ctx.vcsnone:
fg = green
elif ctx.vcsbehind:
fg = red
elif ctx.vcsahead:
fg = blue
elif ctx.vcsdiverged:
fg = magenta
elif ctx.vcsunknown:
fg = red
return fg, bg, attr