Saving to selection doesn't work
I tried both -s primary and -s secondary, but xcolor doesn't seem to save anything to the selection. I'm using Ubuntu 18.04 with Xfce.
Why implement this function. Instead of using with xclip etc. This function is not available on my system, I use it with xclip now.
In #7 I have added a support for "clipboard" selection type. Based on brief testing saving to selection seems to work - at least on my KDE based environment. I would be interested to know if that PR happens to fix the problems you have been experiencing.
In any case, the content is always set to secondary, and it will wait for a certain time when pasting with the middle mouse button.
I'm running arch and in my case the package parcellite (multi entry clipboard) prevented the copy to clipboard. Stopping it helped.
I'm not familiar with the specifics of xcb so unsure as of why parcellite might break things.