Is there a way for a program running in a terminal to ask the terminal what it's forground and background colors are?

@liw nothing standard. there may be some terminal with a private CSI code that does

@liw and yes, this means that you always have to set both foreground and background color, not only one, or you will interact badly with someone's color scheme and be unreadable

(so do the existence of transparent terminals, but those wounds are self-inflicted)

@joeyh What triggered my question is actually that a lot of terminal programs now use colors that are hard for me to read on a white background.

@liw yeah, a lot of people make bad choices given these bad affordances

@liw @joeyh I've started setting TERM=vt220 just to avoid this issue entirely.

@liw On *nix,

`dircolors --print-database | grep "NORMAL"`

may provide you with a place to start, as well as .Xresources. But there's so many terminal emulators out there that use their own setup that I'm not sure there's an universal way. If you find one, I'd be thrilled to hear about it!

Sign in to participate in the conversation

Lars and friends