Skip to content
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

Add possibility to get terminal default foreground and background colors #1134

Open
PavelTurk opened this issue Dec 16, 2024 · 3 comments
Open

Comments

@PavelTurk
Copy link

I searched through the code but couldn't find a way to retrieve the default background/foreground colors of the terminal. At the same time, for Windows, as I understand, the colors are defined -

That's why I suggest to add this feature.

@gnodet
Copy link
Member

gnodet commented Jan 13, 2025

Have you tried using Terminal.getPalette() ?

@PavelTurk
Copy link
Author

@gnodet Yes, I tried. It returns palette from which you can get concrete color by index. But I didn't a way to find out the index of the foreground color and the index of the background color.

@gnodet
Copy link
Member

gnodet commented Feb 1, 2025

This way is very Windows specific. On XTerm, it can be retrieved using echo "\033]10;?\033\\" and echo "\033]11;?\033\\".
A single API to support both from the Palette would be needed somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants