aminomancer / uc.css.js

A dark indigo CSS theme for Firefox and a large collection of privileged scripts to add new buttons, menus, and behaviors and eliminate nuisances. The theme is similar to other userChrome stylesheets, but it's intended for use with an autoconfig loader like fx-autoconfig, since it uses JavaScript to implement its more functional features.
Other
326 stars 27 forks source link

Make findbar highlighted text to always use the same color, no matter the background color of the page in question? #47

Closed ericpa06 closed 2 years ago

ericpa06 commented 2 years ago

image So, this is a little hard to explain, basically depending on the background of the page you are in, the highlighted color of the text (as well as the color of text you are highlighting in itself), when you use the findbar changes, it sorta inverters on darker backgrounds. This thread on FirefoxCSS better explained what I'm talking about: https://old.reddit.com/r/FirefoxCSS/comments/mfw002/keeping_uitexthighlightbackground_consistent_on/gspslgv/

I was wondering if there is any way to make the highlighted text cohesive and to always use to the same color no matter what, like it works on other browsers? As always, thank you very much and sorry to bother.

aminomancer commented 2 years ago

Selection highlighters like the findbar's are implemented in C++ so autoconfig scripts can't do anything to change their behavior. The highlighter is performing calculations to find the contrast between the highlight background color and the background color of the content it's being drawn on. So that's why it's inverting the colors. Anyway, the highlighters use the look-and-feel color system, which can be configured by preferences. If you look in my readme there's a list of recommended settings. It includes selection color settings, the ones that start with ui. If you configure them correctly, the colors will never invert.

It's hard to explain how it works, but it seems to compare the colors as background/foreground layers. So, the way I've done this is to use a color of medium brightness for all the background prefs and white for all the foreground prefs. That way I always get the same colors. However, I'm not sure if you can replace white with black and still get that consistent behavior. If I'm remembering correctly, I think if you use black on ~50% brightness, there's a potential for it to basically flip the layers. I could be wrong though, I haven't looked closely at the source code for this. But I prefer white text anyway, since I use dark reader.

aminomancer commented 2 years ago

You can offer your feedback in this bug though

ericpa06 commented 2 years ago

Thanks.