diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/colorschemes.md | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/doc/colorschemes.md b/doc/colorschemes.md index eb8bdef0..4116a843 100644 --- a/doc/colorschemes.md +++ b/doc/colorschemes.md @@ -1,19 +1,21 @@ -# Colorschemes +Colorschemes +============ This text explains colorschemes and how they work. -## Context Tags +Context Tags +------------ Context Tags provide information about the context. If the tag `in_titlebar` is set, you probably want to know about the color of a part of the titlebar now. -There are a number of context tags, specified in /ranger/gui/context.py in the +There are a number of context tags, specified in `/ranger/gui/context.py` in the constant `CONTEXT_KEYS`. A Context object, defined in the same file, contains attributes with the names -of all tags, whose values are either True or False. +of all tags, whose values are either `True` or `False`. -## Implementation in the GUI Classes +Implementation in the GUI Classes The class CursesShortcuts in the file `/ranger/gui/curses_shortcuts.py` defines the methods `color(*tags)`, `color_at(y, x, wid, *tags)` and `color_reset()`. @@ -25,7 +27,8 @@ color of directories in the titlebar. This creates a `ranger.gui.context.Context object, sets its attributes `in_titlebar` and `directory` to True, leaves the others as False, and passes it to the colorscheme's `use(context)` method. -## The Color Scheme +The Color Scheme +---------------- A colorscheme should be a subclass of `ranger.gui.ColorScheme` and define the method `use(context)`. By looking at the context, this use-method has to @@ -37,7 +40,7 @@ another integer with each bit representing one attribute. These integers are interpreted by the used terminal emulator. Abbreviations for colors and attributes are defined in `ranger.gui.color`. Two -attributes can be combined via bitwise OR: bold | reverse +attributes can be combined via bitwise OR: `bold | reverse` Once the color for a set of tags is determined, it will be cached by default. If you want more dynamic colorschemes (such as a different color for very large @@ -46,7 +49,8 @@ modify the draw-method of the widget to use that tag. Run `tc_colorscheme` to check if your colorschemes are valid. -## Specify a Colorscheme +Specify a Colorscheme +--------------------- Colorschemes are searched for in these directories: @@ -60,7 +64,8 @@ This means, use the colorscheme contained in either `~/.config/ranger/colorschemes/default.py` or `/path/to/ranger/colorschemes/default.py`. -## Adapt a colorscheme +Adapt a colorscheme +------------------- You may want to adapt a colorscheme to your needs without having a complete copy of it, but rather the changes only. Say, you want the exact same colors as in |