Allow to use ANSI 4 bit colors (#6321)

Here some changes which I made when works on #5342 , I think we may say
that it actually fixes #5342 because after that we have full colors in
docs and code which allows user to do colours as he would like to.
This commit is contained in:
Šarūnas Nejus 2026-01-29 22:51:26 +00:00 committed by GitHub
commit 912b7ef2e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 8 deletions

View file

@ -472,13 +472,13 @@ CODE_BY_COLOR = {
"normal": 0,
"bold": 1,
"faint": 2,
# "italic": 3,
"italic": 3,
"underline": 4,
# "blink_slow": 5,
# "blink_rapid": 6,
"blink_slow": 5,
"blink_rapid": 6,
"inverse": 7,
# "conceal": 8,
# "crossed_out": 9
"conceal": 8,
"crossed_out": 9,
# Text colors.
"black": 30,
"red": 31,
@ -488,6 +488,14 @@ CODE_BY_COLOR = {
"magenta": 35,
"cyan": 36,
"white": 37,
"bright_black": 90,
"bright_red": 91,
"bright_green": 92,
"bright_yellow": 93,
"bright_blue": 94,
"bright_magenta": 95,
"bright_cyan": 96,
"bright_white": 97,
# Background colors.
"bg_black": 40,
"bg_red": 41,
@ -497,6 +505,14 @@ CODE_BY_COLOR = {
"bg_magenta": 45,
"bg_cyan": 46,
"bg_white": 47,
"bg_bright_black": 100,
"bg_bright_red": 101,
"bg_bright_green": 102,
"bg_bright_yellow": 103,
"bg_bright_blue": 104,
"bg_bright_magenta": 105,
"bg_bright_cyan": 106,
"bg_bright_white": 107,
}
RESET_COLOR = f"{COLOR_ESCAPE}[39;49;00m"
# Precompile common ANSI-escape regex patterns

View file

@ -145,6 +145,7 @@ Other changes:
unavailable, enabling ``importorskip`` usage in pytest setup.
- Finally removed gmusic plugin and all related code/docs as the Google Play
Music service was shut down in 2020.
- Updated color documentation with ``bright_*`` and ``bg_bright_*`` entries.
2.5.1 (October 14, 2025)
------------------------

View file

@ -467,14 +467,20 @@ Available attributes:
Foreground colors
``black``, ``red``, ``green``, ``yellow``, ``blue``, ``magenta``, ``cyan``,
``white``
``white``, ``bright_black``, ``bright_red``, ``bright_green``,
``bright_yellow``, ``bright_blue``, ``bright_magenta``, ``bright_cyan``,
``bright_white``
Background colors
``bg_black``, ``bg_red``, ``bg_green``, ``bg_yellow``, ``bg_blue``,
``bg_magenta``, ``bg_cyan``, ``bg_white``
``bg_magenta``, ``bg_cyan``, ``bg_white``, ``bg_bright_black``,
``bg_bright_red``, ``bg_bright_green``, ``bg_bright_yellow``,
``bg_bright_blue``, ``bg_bright_magenta``, ``bg_bright_cyan``,
``bg_bright_white``
Text styles
``normal``, ``bold``, ``faint``, ``underline``, ``reverse``
``normal``, ``bold``, ``faint``, ``italic``, ``underline``, ``blink_slow``,
``blink_rapid``, ``inverse``, ``conceal``, ``crossed_out``
terminal_width
~~~~~~~~~~~~~~