The detecting mechanism is terminal-specific (maybe version-specific), so tests on many terminals and environments are required.
If you are interesting in this crate, could you help to test as the following sequence?
$ cargo install termbg
$ termbg
Check terminal background color
Term : Tmux
Color: R=0, G=0, B=0
Theme: Dark
$ cargo uninstall termbg
I want to know the output of termbg and your environment like below:
OS
terminal name/version
terminal multiplexer (ex. tmux/screen) name/version if it is used
Nice. This would be useful as part of a termcolor/ncurses library, even if guessing is the best possible general result. You've probably done your own research, but here are some links to people who have covered this ground before.
The main approaches other have taken which you don't seem to have covered yet is (1) a fallback for "known unknowns" like TERM=linux or putty or cygwin, and (2) whatever "OS specific interfaces" there are for DOS/Windows.
I ran into the former. The use case is working over SSH without forwarded environment. The TERM is linux and the actual background color is black.
Check terminal background color
Term : Xterm
Color: R=3333, G=3333, B=3333
Theme: Dark
The end result (Dark) ended up being correct, but the colors are not. I was also thrown by "Term: Xterm" before I realized it meant "default fallback which is assumed to be an Xterm variant".
Thank you for a lot of information.
I referred to vim/emacs approach.
I think "known unknown" should be failed as a library, because the way of fallback is application-specific.
I'll add windows consle support through WIN32API at the next release.
The result of your environment seems to be correct.
The detected color is #333333, it looks like black.
The result means your terminal responsed to "Xterm Control Sequence".
"Term : Xterm" may be misleading, it should be "Term: Xterm-compatible".
Anyway, thank you again for your interesting in this crate!