diff options
author | hut <hut@lavabit.com> | 2010-03-11 20:52:31 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-03-12 00:46:47 +0100 |
commit | a0fdb913401a6f28b1dfbca248d41c147b12cd20 (patch) | |
tree | 76d9cb487a46b8d20e87ddfcd57c0ca3250a9ebc /ranger | |
parent | 0128bee71f734138d3f49f56092688bb0623c6a2 (diff) | |
download | ranger-a0fdb913401a6f28b1dfbca248d41c147b12cd20.tar.gz |
added two new colorschemes using 88 colors
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/colorschemes/default88.py | 59 | ||||
-rw-r--r-- | ranger/colorschemes/texas.py | 73 | ||||
-rw-r--r-- | ranger/defaults/options.py | 12 |
3 files changed, 136 insertions, 8 deletions
diff --git a/ranger/colorschemes/default88.py b/ranger/colorschemes/default88.py new file mode 100644 index 00000000..b78d1bb5 --- /dev/null +++ b/ranger/colorschemes/default88.py @@ -0,0 +1,59 @@ +# Copyright (C) 2009, 2010 Roman Zimbelmann <romanz@lavabit.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +""" +The default colorscheme, using 88 colors. + +For now, just map each of the 8 base colors to new ones +for brighter blue, etc. and do some minor modifications. +""" + +from ranger.gui.colorscheme import ColorScheme +from ranger.gui.color import * + +from ranger.colorschemes.default import Default +import curses + +class Scheme(Default): + def use(self, context): + fg, bg, attr = Default.use(self, context) + + if curses.COLORS != 88: + return fg, bg, attr + + try: + translate = { + blue: 22, + yellow: 72, + green: 20, + cyan: 21, + white: 79, + red: 32, + magenta: magenta, + } + fg = translate[fg] + except KeyError: + pass + + if context.in_browser: + if context.main_column and context.marked: + if context.selected: + fg = 77 + else: + fg = 68 + attr |= reverse + + return fg, bg, attr + diff --git a/ranger/colorschemes/texas.py b/ranger/colorschemes/texas.py new file mode 100644 index 00000000..93fd4791 --- /dev/null +++ b/ranger/colorschemes/texas.py @@ -0,0 +1,73 @@ +# Copyright (C) 2009, 2010 Roman Zimbelmann <romanz@lavabit.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +""" +Some experimental colorscheme. +""" + +from ranger.gui.colorscheme import ColorScheme +from ranger.gui.color import * + +from ranger.colorschemes.default import Default +import curses + +class Scheme(Default): + def use(self, context): + fg, bg, attr = Default.use(self, context) + + if curses.COLORS < 88: + return fg, bg, attr + + dircolor = 77 + dircolor_selected = {True: 79, False: 78} + linkcolor = {True: 21, False: 48} + + if context.in_browser: + if context.media: + if context.image: + fg = 20 + elif context.video: + fg = 22 + elif context.audio: + fg = 23 + + if context.container: + fg = 32 + if context.directory: + fg = dircolor + if context.selected: + fg = dircolor_selected[context.main_column] + elif context.executable and not \ + any((context.media, context.container)): + fg = 82 + if context.link: + fg = linkcolor[context.good] + + if context.main_column: + if context.selected: + attr |= bold + if context.marked: + attr |= bold + fg = 53 + + if context.in_titlebar: + if context.hostname: + fg = context.bad and 48 or 82 + elif context.directory: + fg = dircolor + elif context.link: + fg = linkcolor[True] + + return fg, bg, attr diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py index 8711f737..34e0c37e 100644 --- a/ranger/defaults/options.py +++ b/ranger/defaults/options.py @@ -21,14 +21,10 @@ intact and the type of the value stays the same. from ranger.api.options import * -# Which colorscheme to use? There are these by default: -# colorschemes.texas -# colorschemes.jungle -# colorschemes.default -# colorschemes.snow -# Texas uses 88 colors. If they are not supported, it will fall back -# to the default scheme. -colorscheme = colorschemes.texas +# Which colorscheme to use? These colorschemes are available by default: +# default, default88, texas, jungle, snow +# Snow is monochrome, texas and default88 use 88 colors. +colorscheme = colorschemes.default max_history_size = 20 scroll_offset = 2 |