dalance / termbg

A Rust library for terminal background color detection
Apache License 2.0
80 stars 5 forks source link

Can't get the background color in neovim terminal emulator #3

Open jiaming-shi opened 3 years ago

jiaming-shi commented 3 years ago

From the documentation, we know that neovim embeds a VT220/xterm terminal emulator based on libvterm. But, termbg currently can't get background color in neovim terminal emulator.

Environment:

Reproduce step:

  1. Open neovim without config file: nvim -u NONE
  2. Open terminal in neovim via :terminal
  3. Run cargo run in nvim terminal emulator

The output is:

Check terminal background color
  Term : XtermCompatible
  Color: detection failed Timeout { source: Timeout }
  Theme: detection failed Timeout { source: Timeout }
dalance commented 3 years ago

libvterm may not support to query background color through OSC 11. I tried like below, but no response.

$ printf "\x1b]11;?\x1b\\"

If libvterm doesn't support the query, termbg can't get background color.

dalance commented 3 years ago

I tried to run neovim built with DEBUG=1, and got below:

libvterm: Unhandled OSC 11;?

This shows libvterm doesn't support OSC 11 query yet.