From: Richard Si <63936253+ichard26@users.noreply.github.com> Date: Wed, 15 Dec 2021 00:32:14 +0000 (-0500) Subject: Don't colour diff headers white, only bold (GH-2691) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/3083f4470bba6838d0ad59e9748f45a7621623b5?ds=inline Don't colour diff headers white, only bold (GH-2691) So people with light themed terminals can still read 'em. --- diff --git a/CHANGES.md b/CHANGES.md index 87e36f4..c73295c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,8 @@ - Improve error message for invalid regular expression (#2678) - Fix mapping cases that contain as-expressions, like `case {"key": 1 | 2 as password}` (#2686) +- No longer color diff headers white as it's unreadable in light themed terminals + (#2691) ## 21.12b0 diff --git a/src/black/output.py b/src/black/output.py index f030d0a..9561d4b 100644 --- a/src/black/output.py +++ b/src/black/output.py @@ -81,7 +81,7 @@ def color_diff(contents: str) -> str: lines = contents.split("\n") for i, line in enumerate(lines): if line.startswith("+++") or line.startswith("---"): - line = "\033[1;37m" + line + "\033[0m" # bold white, reset + line = "\033[1m" + line + "\033[0m" # bold, reset elif line.startswith("@@"): line = "\033[36m" + line + "\033[0m" # cyan, reset elif line.startswith("+"): diff --git a/tests/test_black.py b/tests/test_black.py index 2d0a7df..468f00f 100644 --- a/tests/test_black.py +++ b/tests/test_black.py @@ -200,7 +200,7 @@ class BlackTestCase(BlackBaseTestCase): ) actual = result.output # Again, the contents are checked in a different test, so only look for colors. - self.assertIn("\033[1;37m", actual) + self.assertIn("\033[1m", actual) self.assertIn("\033[36m", actual) self.assertIn("\033[32m", actual) self.assertIn("\033[31m", actual) @@ -323,7 +323,7 @@ class BlackTestCase(BlackBaseTestCase): actual = result.output # We check the contents of the diff in `test_expression_diff`. All # we need to check here is that color codes exist in the result. - self.assertIn("\033[1;37m", actual) + self.assertIn("\033[1m", actual) self.assertIn("\033[36m", actual) self.assertIn("\033[32m", actual) self.assertIn("\033[31m", actual)