diff options
author | Anteru <bitbucket@ca.sh13.net> | 2018-12-16 16:41:41 +0000 |
---|---|---|
committer | Anteru <bitbucket@ca.sh13.net> | 2018-12-16 16:41:41 +0000 |
commit | 9604223f168753dd73531d6b53ec302331de61e6 (patch) | |
tree | 1fac0eba317c0fda938f6e90b0222db5d167f0e2 /pygments/formatters/terminal256.py | |
parent | 64047332da7a0a5d574824b070caa90b39518047 (diff) | |
parent | 96933283e66f789e09332e7216e7e6e4519845f5 (diff) | |
download | pygments-9604223f168753dd73531d6b53ec302331de61e6.tar.gz |
Merged in natashawatkins/pygments-main/natashawatkins/julia-06 (pull request #728)
Add julia 0.6 language features to julia.py
Approved-by: joshday <emailjoshday@gmail.com>
Approved-by: Mykel Kochenderfer <mykel@stanford.edu>
Diffstat (limited to 'pygments/formatters/terminal256.py')
-rw-r--r-- | pygments/formatters/terminal256.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pygments/formatters/terminal256.py b/pygments/formatters/terminal256.py index b80dc7dd..b18aca65 100644 --- a/pygments/formatters/terminal256.py +++ b/pygments/formatters/terminal256.py @@ -50,7 +50,7 @@ class EscapeSequence: attrs = [] if self.fg is not None: if self.fg in ansicolors: - esc = codes[self.fg[5:]] + esc = codes[self.fg.replace('ansi','')] if ';01m' in esc: self.bold = True # extract fg color code. @@ -59,7 +59,7 @@ class EscapeSequence: attrs.extend(("38", "5", "%i" % self.fg)) if self.bg is not None: if self.bg in ansicolors: - esc = codes[self.bg[5:]] + esc = codes[self.bg.replace('ansi','')] # extract fg color code, add 10 for bg. attrs.append(str(int(esc[2:4])+10)) else: @@ -110,6 +110,12 @@ class Terminal256Formatter(Formatter): `Terminal256Formatter` will map these to non extended foreground color. See :ref:`AnsiTerminalStyle` for more information. + .. versionchanged:: 2.4 + The ansi color names have been updated with names that are easier to + understand and align with colornames of other projects and terminals. + See :ref:`NewAnsiColorNames` for more information. + + Options accepted: `style` @@ -189,7 +195,7 @@ class Terminal256Formatter(Formatter): def _color_index(self, color): index = self.best_match.get(color, None) if color in ansicolors: - # strip the `#ansi` part and look up code + # strip the `ansi/#ansi` part and look up code index = color self.best_match[color] = index if index is None: |