more color contrast

This continues the work started in #889.

I noticed poor color contrasts with some instance themes (see for example https://heiligenhaus.ypart.eu/). So this adds some more contrast-based color selection to avoid that issue.