thats actually a hardish problem to solve.
I originally had a feature like that, but I just couldn't figure out what background colours to use.
For example the asexual flag here https://ladygeekgirl.files.wordpress.com/2015/02/asexual-fla...
Its black, grey, white, and dark purple, I just don't know what kind of background colour would actually make text more legible.
I could do different background colours for each gradient, but thats probably even ugiler.
Do you have any suggestions?