summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorten Enemark Lund <melund@gmail.com>2018-08-21 08:09:07 +0200
committerMorten Enemark Lund <melund@gmail.com>2018-08-21 08:09:07 +0200
commite22d30b61416fc024cde4f262b36383ff9b19e3b (patch)
tree817f8b1bbe9a350caa1058900a5d185f27ee3b31
parent9ddc62fd449592eaee42b4026884b976b2fb3b64 (diff)
downloadpygments-e22d30b61416fc024cde4f262b36383ff9b19e3b.tar.gz
Ensure terminal formatter works with new ansi colors names
-rw-r--r--pygments/console.py11
-rw-r--r--pygments/formatters/terminal256.py4
2 files changed, 6 insertions, 9 deletions
diff --git a/pygments/console.py b/pygments/console.py
index 31b6839d..27d46e7a 100644
--- a/pygments/console.py
+++ b/pygments/console.py
@@ -22,10 +22,10 @@ codes["underline"] = esc + "04m"
codes["blink"] = esc + "05m"
codes["overline"] = esc + "06m"
-dark_colors = ["black", "darkred", "darkgreen", "brown", "darkblue",
- "purple", "teal", "lightgray"]
-light_colors = ["darkgray", "red", "green", "yellow", "blue",
- "fuchsia", "turquoise", "white"]
+dark_colors = ["black", "red", "green", "yellow", "blue",
+ "magenta", "cyan", "gray"]
+light_colors = ["brightblack", "brightgreen", "brightgreen", "brightyellow", "brightblue",
+ "brightmagenta", "brightcyan", "white"]
x = 30
for d, l in zip(dark_colors, light_colors):
@@ -35,9 +35,6 @@ for d, l in zip(dark_colors, light_colors):
del d, l, x
-codes["darkteal"] = codes["turquoise"]
-codes["darkyellow"] = codes["brown"]
-codes["fuscia"] = codes["fuchsia"]
codes["white"] = codes["bold"]
diff --git a/pygments/formatters/terminal256.py b/pygments/formatters/terminal256.py
index 88bc23ce..7e9214bc 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.lstrip('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.lstrip('ansi')]
# extract fg color code, add 10 for bg.
attrs.append(str(int(esc[2:4])+10))
else: