diff options
author | toonn <toonn@toonn.io> | 2018-09-08 22:38:48 +0200 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2018-09-08 22:38:48 +0200 |
commit | eae69fa3811818ce994c233bcd0cafea81a4c632 (patch) | |
tree | c36ad1ea1dfa5cfb3b82b801772257bd97253317 /ranger | |
parent | 060541865e08eac3d04db268a3be52c4e4a579a8 (diff) | |
parent | 60b566061fc9948a97735802fd637baddaced7b2 (diff) | |
download | ranger-eae69fa3811818ce994c233bcd0cafea81a4c632.tar.gz |
Merge branch 'boldisnotbright'
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/colorschemes/default.py | 25 | ||||
-rw-r--r-- | ranger/colorschemes/snow.py | 4 | ||||
-rw-r--r-- | ranger/gui/color.py | 5 |
3 files changed, 29 insertions, 5 deletions
diff --git a/ranger/colorschemes/default.py b/ranger/colorschemes/default.py index 350c8359..a9e01e0c 100644 --- a/ranger/colorschemes/default.py +++ b/ranger/colorschemes/default.py @@ -6,7 +6,7 @@ from __future__ import (absolute_import, division, print_function) from ranger.gui.colorscheme import ColorScheme from ranger.gui.color import ( black, blue, cyan, green, magenta, red, white, yellow, default, - normal, bold, reverse, + normal, bold, reverse, dim, BRIGHT, default_colors, ) @@ -39,18 +39,22 @@ class Default(ColorScheme): if context.directory: attr |= bold fg = blue + fg += BRIGHT elif context.executable and not \ any((context.media, context.container, context.fifo, context.socket)): attr |= bold fg = green + fg += BRIGHT if context.socket: - fg = magenta attr |= bold + fg = magenta + fg += BRIGHT if context.fifo or context.device: fg = yellow if context.device: attr |= bold + fg += BRIGHT if context.link: fg = cyan if context.good else magenta if context.tag_marker and not context.selected: @@ -59,10 +63,19 @@ class Default(ColorScheme): fg = white else: fg = red + fg += BRIGHT if not context.selected and (context.cut or context.copied): - fg = black attr |= bold + fg = black + fg += BRIGHT + # If the terminal doesn't support bright colors, use dim white + # instead of black. + if BRIGHT == 0: + attr |= dim + fg = white if context.main_column: + # Doubling up with BRIGHT here causes issues because it's + # additive not idempotent. if context.selected: attr |= bold if context.marked: @@ -78,7 +91,6 @@ class Default(ColorScheme): fg = cyan elif context.in_titlebar: - attr |= bold if context.hostname: fg = red if context.bad else green elif context.directory: @@ -88,6 +100,8 @@ class Default(ColorScheme): bg = green elif context.link: fg = cyan + attr |= bold + fg += BRIGHT elif context.in_statusbar: if context.permissions: @@ -98,13 +112,16 @@ class Default(ColorScheme): if context.marked: attr |= bold | reverse fg = yellow + fg += BRIGHT if context.frozen: attr |= bold | reverse fg = cyan + fg += BRIGHT if context.message: if context.bad: attr |= bold fg = red + fg += BRIGHT if context.loaded: bg = self.progress_bar_color if context.vcsinfo: diff --git a/ranger/colorschemes/snow.py b/ranger/colorschemes/snow.py index 8e9686a8..c5f23c1c 100644 --- a/ranger/colorschemes/snow.py +++ b/ranger/colorschemes/snow.py @@ -4,7 +4,7 @@ from __future__ import (absolute_import, division, print_function) from ranger.gui.colorscheme import ColorScheme -from ranger.gui.color import default_colors, reverse, bold +from ranger.gui.color import default_colors, reverse, bold, BRIGHT class Snow(ColorScheme): @@ -20,6 +20,7 @@ class Snow(ColorScheme): attr = reverse if context.directory: attr |= bold + fg += BRIGHT elif context.highlight: attr |= reverse @@ -36,6 +37,7 @@ class Snow(ColorScheme): elif context.in_taskview: if context.selected: attr |= bold + fg += BRIGHT if context.loaded: attr |= reverse diff --git a/ranger/gui/color.py b/ranger/gui/color.py index 45f983e8..8f6439c7 100644 --- a/ranger/gui/color.py +++ b/ranger/gui/color.py @@ -66,6 +66,11 @@ blink = curses.A_BLINK reverse = curses.A_REVERSE underline = curses.A_UNDERLINE invisible = curses.A_INVIS +dim = curses.A_DIM default_colors = (default, default, normal) # pylint: enable=invalid-name,bad-whitespace + +curses.setupterm() +# Adding BRIGHT to a color achieves what `bold` was used for. +BRIGHT = 8 if curses.tigetnum('colors') >= 16 else 0 |