It’s all about preserving adequate contrast. If we want to stop inverting the text color in our selections, we need to desaturate or lighten the highlight color behind it.
This is doable by changing the Breeze color scheme. We also probably need to change the Breeze QStyle to change the menu selection style so that it uses the exact highlight color for selections, rather than a lightened version of it. That way the color scheme is always in charge.
NeoChat uses custom list delegates, a relic from the time before ItemDelegate had a rounded highlight style. Apps using that custom delegate need to be ported to use ItemDelegate or its subclasses, and any visual improvements it still retains should to be added to the standard stuff so everyone can benefit.
This is provided by the colour scheme so probably best to leave it alone.
However something related: for Klassy, I wrote a custom function that draws automatically either black or white foregrounds depending on which would give best contrast. This is user-selectable. Posting in-case it is of interest for reuse.
Slightly off-topic, but I also wrote a function that tints any symbolic-style image/icon with a custom colour far better than anything that I could find in the KColorUtils or Qt effects libraries. (unless someone else knows of something else available, I think this would be a valuable addition to KColorUtils)
The tint functions in the KColorUtils and Qt effects libraries tint by replacing the colour black with your desired tint colour. This only works well in some cases.
My convertAlphaToColor function instead uses the alpha mask of the source image and paints in your tint colour per-pixel using that alpha mask: