I discovered xterm-direct and decided to play with it a little bit. I'd setup some color pairs, then ran the program, but all colours were black.
At first I thought that I'd setup colours incorrectly or maybe xterm-direct was just broken, but after some experimenting and digging around I realized that it interprets the index in color pair as an RGB value, and colours weren't actually black, just very dark red :).
I wonder whether this is intentional? I think most programs assume that it is always an index, and not an RGB value. Should I detect TERM=xterm-direct and use different code to setup color pairs in such case? Though probably nobody uses xterm-direct.