Open zachriggle opened 3 years ago
As a follow-up, this appears non-trivial to detect as the xterm control sequences lie.
https://github.com/dalance/termbg/blob/b2be3b50d20502a5b7e6d34eab6a4eedb0151693/src/lib.rs#L183-L191
For Terminal.app, regardless of whether the System Appearance is Light (white background) or Dark (black background) the same result is returned.
$ ( echo -e "\x1b]11;?\x1b\\" > /dev/tty; read -r line </dev/tty; echo "$line" | xxd )
00000000: 1b5d 3131 3b72 6762 3a31 6531 652f 3165 .]11;rgb:1e1e/1e
00000010: 3165 2f31 6531 6507 0a 1e/1e1e..
A possible fix is special-case detection for:
$TERM_PROGRAM=Apple_Terminal
defaults read -globalDomain AppleInterfaceStyle
This seems like a bug report should be filed to apple
termbg
is pretty great and easy to use / test viacargo run
.However, I noticed that when using macOS Terminal.app, with the default profile ("Basic"), the results are incorrect.
It seems that
termbg
(or one of its dependencies) does not take into account the macOS systemwide appearance, which changes the color of the default terminal from white (Light mode) to black (Dark mode). This setting may change at any time, and can be fetched with:Note that this is the ONLY Terminal.app Profile which behaves this way (AFAIK).
Examples