[PR #13748] Make sure the inverted cursor is always readable (#3647) #29742

Open
opened 2026-01-31 09:36:38 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/13748

State: closed
Merged: Yes


Currently "Inverse Cursor" is actually simply bitwise inversed.
It works fine, except when it does not, namely in the middle of the spectrum:
Anything close enough to dark grey (index 8, RGB(128, 128, 128) in the
classic palette) will for obvious reasons become almost the same dark grey
again after the inversion.

The issue is addressed by additionally XORing the inverted color with
RGB(63, 63, 63). This distorts the result enough to avoid collisions
in the middle. Ultimately this restores the behavior that was in
Windows Console since the Middle Ages (and still exists in ConhostV1.dll).

PR Checklist

Validation Steps Performed

  1. Open OpenConsole.
  2. Properties, Terminal, Cursor Colors, choose Inverse Color.
  3. Optionally set the RGB value of the 8th color in the standard palette to RGB(128, 128, 128) on the Colors tab, but the default one will do too.
  4. Type color 80 to see black text on dark grey background.
  5. Make sure the inverted cursor is visible.
  6. Repeat in WT with both default and experimental renderers.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/13748 **State:** closed **Merged:** Yes --- Currently "Inverse Cursor" is actually simply bitwise inversed. It works fine, except when it does not, namely in the middle of the spectrum: Anything close enough to dark grey (index 8, RGB(128, 128, 128) in the classic palette) will for obvious reasons become almost the same dark grey again after the inversion. The issue is addressed by additionally `XOR`ing the inverted color with RGB(63, 63, 63). This distorts the result enough to avoid collisions in the middle. Ultimately this restores the behavior that was in Windows Console since the Middle Ages (and still exists in ConhostV1.dll). ## PR Checklist * [x] Closes #3647 * [x] CLA signed * [x] Tests added/passed * [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #3647 ## Validation Steps Performed 1. Open OpenConsole. 2. Properties, Terminal, Cursor Colors, choose Inverse Color. 3. Optionally set the RGB value of the 8th color in the standard palette to RGB(128, 128, 128) on the Colors tab, but the default one will do too. 4. Type `color 80` to see black text on dark grey background. 5. Make sure the inverted cursor is visible. 6. Repeat in WT with both default and experimental renderers.
claunia added the pull-request label 2026-01-31 09:36:38 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29742