ANSI Invert displays incorrect colours #9255

Closed
opened 2026-01-31 01:49:49 +00:00 by claunia · 4 comments
Owner

Originally created by @Starwort on GitHub (Jun 25, 2020).

Environment

Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd] Microsoft Windows [Version 10.0.18362.900]
Windows Terminal version (if applicable): 1.0.1401.0

Any other software? None relevant

Steps to reproduce

Set your foreground and white colours, (as well as background and black colours) to something you will be able to distinguish.
For the purpose of this example, foreground is green, background is dark (#121212 for Terminal and #0c0c0c for WSL TTY), white (terminal) is red, and black (terminal) is blue
Launch e.g. Python (anything that can print ANSI codes), print ANSI invert and restore codes as follows:

>>> print('\x1b[7m')
>>> print('\x1b[27m')

Expected behaviour

Output similar to in the WSL dedicated terminal:
image

Actual behaviour

White and Black configured colours are being used in place of swapped foreground and background
In PowerShell:
image
In WSL:
image
In CMD:
image

Originally created by @Starwort on GitHub (Jun 25, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: [run `[Environment]::OSVersion` for powershell, or `ver` for cmd] Microsoft Windows [Version 10.0.18362.900] Windows Terminal version (if applicable): 1.0.1401.0 Any other software? None relevant ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> Set your foreground and white colours, (as well as background and black colours) to something you will be able to distinguish. For the purpose of this example, foreground is green, background is dark (#121212 for Terminal and #0c0c0c for WSL TTY), white (terminal) is red, and black (terminal) is blue Launch e.g. Python (anything that can print ANSI codes), print ANSI invert and restore codes as follows: ```py >>> print('\x1b[7m') >>> print('\x1b[27m') ``` # Expected behaviour Output similar to in the WSL dedicated terminal: ![image](https://user-images.githubusercontent.com/16487249/85644758-cc286780-b68f-11ea-9aae-58cf9fb05663.png) # Actual behaviour White and Black configured colours are being used in place of swapped foreground and background In PowerShell: ![image](https://user-images.githubusercontent.com/16487249/85644810-e8c49f80-b68f-11ea-9f73-c8d2038eeaec.png) In WSL: ![image](https://user-images.githubusercontent.com/16487249/85644829-fbd76f80-b68f-11ea-9724-dbb5ecaf9979.png) In CMD: ![image](https://user-images.githubusercontent.com/16487249/85644864-10b40300-b690-11ea-95be-b0f13e1142ca.png)
claunia added the Resolution-Duplicate label 2026-01-31 01:49:49 +00:00
Author
Owner

@Starwort commented on GitHub (Jun 25, 2020):

Now I can set my black/white back properly 👀

@Starwort commented on GitHub (Jun 25, 2020): Now I can set my black/white back properly :eyes:
Author
Owner

@j4james commented on GitHub (Jun 25, 2020):

It looks like this is another variant of issue #2661. It'll be fixed by PR #6506.

@j4james commented on GitHub (Jun 25, 2020): It looks like this is another variant of issue #2661. It'll be fixed by PR #6506.
Author
Owner

@zadjii-msft commented on GitHub (Jun 25, 2020):

/dup #2661

@zadjii-msft commented on GitHub (Jun 25, 2020): /dup #2661
Author
Owner

@ghost commented on GitHub (Jun 25, 2020):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Jun 25, 2020): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#9255