Open nickolay opened 1 year ago
Detection through COLORFGBG
was implemented previously.
https://github.com/dalance/termbg/blob/763d16e362a437c4718e3dc0eafcacbfb69e0dec/src/lib.rs#L124
I removed it because there seems to be a few usable case, but it can be reverted if it is useful.
Oh, sorry, didn't see that!
To elaborate on why I thought it would be nice to have some fallback: as a user of an unsupported terminal with light background, I'd like to indicate my preference once (e.g. by setting COLORFGBG
) instead of finding a way to configure colors for every program I'm trying out.
Of course this would only have noticeable effect when enough programs use termbg
, but I assume that's the goal:)
Anyway, thanks for your work on this crate! Getting the rust ecosystem to properly support light-background terminals would be really nice to people like me who can't read white-on-black without straining their eyes too much.
I added the fallback and released v0.4.2.
Wow you're fast!
On Windows though unsupported terminals are detected as Terminal::Windows
and as far as I can see from_winapi
can't fail, so the fallback doesn't work well. Do you think it's appropriate to submit pull requests to make pub fn terminal()
detect specific unsupported terminals (e.g. ConEmuPID
-> ConEmu -> fallback to COLORFGBG)?
For unsupported terminals it would be nice to have some fallback.
According to https://unix.stackexchange.com/questions/245378/common-environment-variable-to-set-dark-or-light-terminal-background / https://github.com/rocky/shell-term-background there's no well-established standard, but the
COLORFGBG
environment variable has some potential: Value15;0
is for a dark background (technically white on black) and0;15
(technically black on white) is for a light background.Would you be willing to adopting this?