According to the man pages the return value of pair_content() is somewhat undefined:
"All other routines return the integer ERR upon failure and an OK (SVr4 specifies only an integer value other than ERR”) upon successful completion. X/Open defines no error conditions."
I would like to kindly proposing that pair_content() return ERR if specific pair hasn't been set.
Since libvterm is a shared library, it has no way of knowing what pairs have been initialized by the integrator. Therefore, I have to build my own linked list of pairs and query all possible values. If pair_content() would return ERR, it would save a lot of wasted space. I've looked at the ncurses source code and it seems that all would need to be done is to move "mode" out of the precompiler conditional in colorpair_t and then add an additional check in the macro ValidPair to inspect "mode".
(The part about moving "mode" is probably unnecessary. I suspect the linked list implementation has been around long enough that USE_NEW_PAIR is always defined.)
--
Bryan
<><