Auto contrast adjustment on display names

I realized we can calculate the colors because know the background colors for adwaita, so we just need to check light/dark and go from there.

But i saw something about some new algorithm and when I was looking I was having issues parsing the math and couldn’t find the links we were looking at previously for this.

I don’t suppose anyone remembers what they were or is able to find them again?

Judging from this and following you were looking at the algorithm Gajim is using.

1 Like

Good call on searching discord and I’m sad I didn’t think of that. Clearly this is another reason why we should be having these discussions here too :smiley:

At any rate, this will help me pick this back up so thank you!

1 Like

Looks like this has all the math we need for this. I’m not sure how this will handle the contrast stuff, but it’s at least a starting point.

More information on their web site https://www.hsluv.org/

Sometimes the answers are already documented and you just need to look for them :person_facepalming: Pidgin.color_calculate_for_text

Which one looks better? They’re fuzzy because they’re zoomed in, click on them to see normal resolution.

current code

new incomplete code

The new code definitely looks better to my eyes. There are several names that are unreadable in at least one of the two windows for the current code, but they’re all readable in the new code.

1 Like

Good to hear. This is the expected result as the new code uses a standard implementation, but you know, always good to ask others too :slight_smile:

The “incompleteness” here is that it doesn’t auto detect light/dark mode yet so I just hard coded it for both screen shots.

2 Likes

I also think the new code produced better results.

3 Likes

Cool! As I mentioned on discord and alluded to above, this is based on XEP-0392 so these colors should match other XMPP clients that implement this XEP and potentially other clients too.

2 Likes

This was landed in /r/4211.

2 Likes