| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1431,7 +1431,7 @@ def print_line(self, s, clr=False): | |||
| 1431 | 1431 | tokens = chain([(Token.String, value[3:])], tokens) | |
| 1432 | 1432 | else: | |
| 1433 | 1433 | tokens = PythonLexer().get_tokens(s) | |
| 1434 | - o = format(tokens, BPythonFormatter()) | ||
| 1434 | + o = format(tokens, BPythonFormatter(OPTS.color_scheme)) | ||
| 1435 | 1435 | else: | |
| 1436 | 1436 | o = s | |
| 1437 | 1437 | ||
@@ -1838,6 +1838,7 @@ def safeget(self, section, option, default): | |||
| 1838 | 1838 | OPTS.hist_file = config.safeget('general', 'hist_file', '~/.pythonhist') | |
| 1839 | 1839 | OPTS.hist_length = config.safeget('general', 'hist_length', 100) | |
| 1840 | 1840 | OPTS.flush_output = config.safeget('general', 'flush_output', True) | |
| 1841 | + OPTS.color_scheme = config.safeget('general', 'color_scheme', 'dark') | ||
| 1841 | 1842 | ||
| 1842 | 1843 | ||
| 1843 | 1844 | class FakeDict(object): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -100,7 +100,12 @@ class BPythonFormatter(Formatter): | |||
| 100 | 100 | See the Pygments source for more info; it's pretty | |
| 101 | 101 | straightforward.""" | |
| 102 | 102 | ||
| 103 | - def __init__(self, **options): | ||
| 103 | + def __init__(self, color_scheme, **options): | ||
| 104 | + if color_scheme == "light": | ||
| 105 | + self.f_strings = f_strings_light | ||
| 106 | + else: | ||
| 107 | + self.f_strings = f_strings | ||
| 108 | + | ||
| 104 | 109 | Formatter.__init__(self, **options) | |
| 105 | 110 | ||
| 106 | 111 | def format(self, tokensource, outfile): | |
@@ -109,10 +114,10 @@ def format(self, tokensource, outfile): | |||
| 109 | 114 | if text == '\n': | |
| 110 | 115 | continue | |
| 111 | 116 | ||
| 112 | - if token in f_strings: | ||
| 113 | - o += "%s\x03%s\x04" % (f_strings[token], text ) | ||
| 117 | + if token in self.f_strings: | ||
| 118 | + o += "%s\x03%s\x04" % (self.f_strings[token], text ) | ||
| 114 | 119 | else: | |
| 115 | - o += "%s\x03%s\x04" % (f_strings[Token], text ) | ||
| 120 | + o += "%s\x03%s\x04" % (self.f_strings[Token], text ) | ||
| 116 | 121 | outfile.write(o.rstrip()) | |
| 117 | 122 | ||
| 118 | 123 | # vim: sw=4 ts=4 sts=4 ai et | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | 2 | # This is a standard python .ini file | |
| 3 | - # Valid values can be True, False, integer numbers, quoted strings | ||
| 3 | + # Valid values can be True, False, integer numbers, strings | ||
| 4 | 4 | # By default bpython will look for ~/.bpython.ini or you can specify a file as | |
| 5 | 5 | # the first argument on the command line | |
| 6 | 6 | ||
@@ -18,12 +18,16 @@ syntax = True | |||
| 18 | 18 | # when possible (default: True). | |
| 19 | 19 | arg_spec = True | |
| 20 | 20 | ||
| 21 | - # History file (default: "~/.pythonhist"): | ||
| 22 | - hist_file = "~/.pythonhist" | ||
| 21 | + # History file (default: ~/.pythonhist): | ||
| 22 | + hist_file = ~/.pythonhist | ||
| 23 | 23 | ||
| 24 | 24 | # Number of lines to store in history (set to 0 to disable) (default: 100): | |
| 25 | 25 | hist_len = 100 | |
| 26 | 26 | ||
| 27 | 27 | # Soft tab size (default: 4, see pep-8): | |
| 28 | 28 | tab_length = 4 | |
| 29 | 29 | ||
| 30 | + # Colour scheme can be "dark" or "light" (for dark and light background | ||
| 31 | + # terminals) (default: dark) | ||
| 32 | + color_scheme = dark | ||
| 33 | + | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments