First, it is unlikely that some alternative method (other than responses to control sequences) could be the basis of "a general solution" as requested by the OP, since the property sought is not (for example) amenable to methods using the window properties.
Next, this is an example of control sequences which are implemented in xterm but not generally available. The developer of xtermcontrol
is aware of this. His page discusses xterm control sequences, comments that there are many of them (a plethora), and mentions that OSX Terminal.app supports some of them.
The error message reported by OP is certainly clear enough. The unnamed program on which OP attempted to run xtermcontrol
does not support the feature. Likely enough, it does not support a comparable feature which could be used instead.
In practice, a majority of xterm's control sequences are not implemented in other terminals, regardless of their developer's use of "xterm" for the terminal description. See for example the xterm FAQ Comparing versions, by counting controls, and the ncurses FAQ Why not just use TERM set to "xterm"? (noting that "derived from the xterm
source code" can be interpreted in more than one way).
The terminals of (perhaps) more interest to OP have no useful documentation on which control sequences they implement. So the only way to find how "general" a solution you have is to exhaustively test it. That seems not very general.
The top-voted Super User answer is the method used by xtermcontrol
. (The downvoted xrdb
answer will not give you the current color settings from xterm
, only its initial values — perhaps not even that.)
\e]12;?\a
(cursor color), which is more frequently supported, to see how the output should look like (something like12;rgb:aaaa/ffff/2222
).