Support escape sequence to query current console colors #479

Closed
opened 2026-01-30 21:53:21 +00:00 by claunia · 3 comments
Owner

Originally created by @SteveL-MSFT on GitHub (Dec 10, 2018).

@richturn_ms blog post hightlights a known issue with PowerShell and non-index0 background color. However, it's possible for PSReadLine to fix this if it can [query for the current console colors] (https://superuser.com/questions/157563/programmatic-access-to-current-xterm-background-color/406172#406172) using OSC escape sequence. Works on Ubuntu, but not on macOS (default Terminal).

Originally created by @SteveL-MSFT on GitHub (Dec 10, 2018). @richturn_ms blog post hightlights a known issue with PowerShell and non-index0 background color. However, it's possible for PSReadLine to fix this if it can [query for the current console colors] (https://superuser.com/questions/157563/programmatic-access-to-current-xterm-background-color/406172#406172) using OSC escape sequence. Works on Ubuntu, but not on macOS (default Terminal).
claunia added the Product-ConhostResolution-Duplicate labels 2026-01-30 21:53:21 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (Dec 10, 2018):

This is a dupe of (part of) #317, and as a meta-point I absolutely think PSReadline should get completely out of the business of saving and restoring auxiliary console state. People generally don't seem to mind that bash, zsh, fish, etc. inherit whatever state was in effect when the prompt line was generated.

@DHowett-MSFT commented on GitHub (Dec 10, 2018): This is a dupe of (part of) #317, and as a meta-point I absolutely think PSReadline should get _completely out_ of the business of saving and restoring auxiliary console state. People generally don't seem to mind that bash, zsh, fish, etc. inherit whatever state was in effect when the prompt line was generated.
Author
Owner

@DHowett-MSFT commented on GitHub (Dec 10, 2018):

PSReadline should be able to emit SGRs 39 and 49 to encourage the terminal to use its own default, without having to ask the terminal what the default is.

@DHowett-MSFT commented on GitHub (Dec 10, 2018): PSReadline should be able to emit SGRs `39` and `49` to encourage the terminal to _use_ its own default, without having to ask the terminal what the default is.
Author
Owner

@zadjii-msft commented on GitHub (Dec 12, 2018):

Yea, this is a subset of the work being tracked by #317, so I'm gonna close it as a dupe.

@zadjii-msft commented on GitHub (Dec 12, 2018): Yea, this is a subset of the work being tracked by #317, so I'm gonna close it as a dupe.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#479