mirror of https://github.com/cheat/cheat.git
commit
9d1dd15387
|
@ -118,6 +118,13 @@ export CHEAT_COLORS=true
|
||||||
|
|
||||||
Note that [pygments][] must be installed on your system for this to work.
|
Note that [pygments][] must be installed on your system for this to work.
|
||||||
|
|
||||||
|
`cheat` ships with both light and dark colorschemes to support terminals with
|
||||||
|
different background colors. A colorscheme may be selected via the
|
||||||
|
`CHEAT_COLORSCHEME` envvar:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
export CHEAT_COLORSCHEME=light # must be 'light' (default) or 'dark'
|
||||||
|
```
|
||||||
|
|
||||||
#### Specifying a Syntax Highlighter ####
|
#### Specifying a Syntax Highlighter ####
|
||||||
You may manually specify which syntax highlighter to use for each cheatsheet by
|
You may manually specify which syntax highlighter to use for each cheatsheet by
|
||||||
|
|
|
@ -59,4 +59,7 @@ class Colorize:
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return highlight(sheet_content, lexer, TerminalFormatter())
|
return highlight(
|
||||||
|
sheet_content,
|
||||||
|
lexer,
|
||||||
|
TerminalFormatter(bg=self._config.cheat_colorscheme))
|
||||||
|
|
|
@ -41,6 +41,13 @@ class Configuration:
|
||||||
True,
|
True,
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# self.cheat_colorscheme
|
||||||
|
self.cheat_colorscheme = self._select([
|
||||||
|
os.environ.get('CHEAT_COLORSCHEME'),
|
||||||
|
config.get('CHEAT_COLORSCHEME'),
|
||||||
|
'light',
|
||||||
|
]).strip().lower()
|
||||||
|
|
||||||
# self.cheat_user_dir
|
# self.cheat_user_dir
|
||||||
self.cheat_user_dir = self._select([
|
self.cheat_user_dir = self._select([
|
||||||
os.environ.get('CHEAT_USER_DIR'),
|
os.environ.get('CHEAT_USER_DIR'),
|
||||||
|
@ -104,4 +111,10 @@ class Configuration:
|
||||||
Utils.die("%s %s" %
|
Utils.die("%s %s" %
|
||||||
('CHEAT_HIGHLIGHT must be one of:', highlights))
|
('CHEAT_HIGHLIGHT must be one of:', highlights))
|
||||||
|
|
||||||
|
# assert that the color scheme is valid
|
||||||
|
colorschemes = ['light', 'dark']
|
||||||
|
if self.cheat_colorscheme not in colorschemes:
|
||||||
|
Utils.die("%s %s" %
|
||||||
|
('CHEAT_COLORSCHEME must be one of:', colorschemes))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"CHEAT_COLORS" : true,
|
"CHEAT_COLORS" : true,
|
||||||
|
"CHEAT_COLORSCHEME" : "light",
|
||||||
"CHEAT_EDITOR" : "vi",
|
"CHEAT_EDITOR" : "vi",
|
||||||
"CHEAT_PATH" : "/usr/share/cheat"
|
"CHEAT_PATH" : "/usr/share/cheat"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue