How to determine a terminal's background color?
问题 I'd like to know if there is any way to determine a terminal's background color ? In my case, using gnome-terminal. It might matter, since it's entirety up to the terminal application to draw the background of its windows, which may even be something else than a plain color. 回答1: I've came up with the following: #!/bin/sh # # Query a property from the terminal, e.g. background color. # # XTerm Operating System Commands # "ESC ] Ps;Pt ST" oldstty=$(stty -g) # What to query? # 11: text