New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds support for reverse video and underline on Windows 10. #267
Changes from 3 commits
6ee65e5
e0f6ea3
7eb3dcb
752c327
6ee11c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,7 +143,27 @@ Available formatting constants are:: | |
|
||
Fore: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET. | ||
Back: BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, RESET. | ||
Style: DIM, NORMAL, BRIGHT, RESET_ALL | ||
Style: DIM, NORMAL, BRIGHT, BRIGHT_OFF, REVERSE, UNDERLINE, RESET_ALL | ||
|
||
``Style.REVERSE_OFF`` and ``Style.UNDERLINE_OFF`` are provided to allow intent | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I understand correctly, regular ANSI-compliant terminals do have a special code for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's the behaviour I expected (and intended) but there seems to be a problem there. I'll work on that (after rebasing to the current version). |
||
to be clearer. | ||
They currently have the same values as ``REVERSE`` and ``UNDERLINE``, | ||
respectively. Using ``REVERSE`` a 2nd time will toggle REVERSE off again | ||
(and the same for UNDERLINE). | ||
|
||
It's important to realise that ``Style.UNDERLINE_OFF`` and ``Style.REVERSE_OFF`` | ||
are not guaranteed to turn the relevant effect off. If you've called | ||
``colorama.init`` with ``autoreset=False``, and left the terminal in underline | ||
mode, then the next time either ``Style.UNDERLINE`` or ``Style.UNDERLINE_OFF`` | ||
is encountered, underlining will be turned off. | ||
|
||
Note that REVERSE and UNDERLINE require Windows 10, they don't have any effect | ||
on Windows 7 or 8. | ||
jpwroberts marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
``BRIGHT_OFF`` is included because it's a valid ANSI sequence. It will do the | ||
same thing as ``NORMAL``, on Windows. | ||
|
||
On some terminals, it will produce a double underline. | ||
|
||
``Style.RESET_ALL`` resets foreground, background, and brightness. Colorama will | ||
perform this reset automatically on program exit. | ||
|
@@ -254,7 +274,14 @@ The only ANSI sequences that colorama converts into win32 calls are:: | |
ESC [ 0 m # reset all (colors and brightness) | ||
ESC [ 1 m # bright | ||
ESC [ 2 m # dim (looks same as normal brightness) | ||
ESC [ 4 m # underline *1* | ||
ESC [ 7 m # reverse video *1* | ||
ESC [ 21 m # double underline or normal brightness | ||
ESC [ 22 m # normal brightness | ||
ESC [ 24 m # underline off *1* | ||
ESC [ 27 m # reverse video off *1* | ||
|
||
*1. Not supported on Windows 7 or 8.* | ||
jpwroberts marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# FOREGROUND: | ||
ESC [ 30 m # black | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this change is prominent enough to appear in the changelog. It's more "internal".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may have been a bit over-zealous there. Definitely agree about the last two not being in the changelog. The first two result in a change in behaviour, especially no longer getting a BRIGHT foreground colour with CSI [ 30-37 m. That should be documented somewhere, but I'm happy to remove it from the changelog.