systemSetup

system setup, configuration and dotfiles
git clone https://noulin.net/git/systemSetup.git
Log | Files | Refs | README | LICENSE

default.py (4560B)


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