Querying the theme or the background color from the shell
I have a terminal application that uses colors in the output extensively. Ideally, I'd like to ensure that the output is consistent in every theme by adopting iterm2's theme colors. iterm2's proprietary escape sequence provide the means to set arbitrary colors and profiles, but I couldn't find a way to query the current theme. I can accomplish this through Applescript but, as of 3.3.11beta1, I see this error in the output instead of a popup requesting a permission:
Is there an existing mechanism to accomplish this without the need for extra permissions? In particular, is the information available through the use of escape sequences?