easonwong-de / Adaptive-Tab-Bar-Colour

Changes the colour of Firefox tab bar to match the website theme.
https://addons.mozilla.org/firefox/addon/adaptive-tab-bar-colour/
MIT License
310 stars 11 forks source link

add: dynamic contrast-relative overlay opacity #75

Closed bensaine closed 5 months ago

bensaine commented 5 months ago

Related to https://github.com/easonwong-de/Adaptive-Tab-Bar-Colour/issues/74.

Makes it so colours "distant" (high contrast factor) from the base frame colour have a lesser impact on the frame colour.

i.e. Colours that are very bright or saturated will still give a slight overlay to the frame, but not to an overwhelming degree.

This PR adds a setting called "Overlay opacity factor" which controls how quickly the opacity drops in relation to the contrast factor [0-1]. This is the mathematical relation: opacity = 1 - (contrast ^ (factor)), where a factor of 1 is just the additive inverse of the contrast. See graph. The default is a factor of 0.15. This can be controlled if a user wants less or more overlay.

Before:

image

After:

image
CennoxX commented 5 months ago

This solution breaks the main functionality of the addon: "Changes the colour of Firefox tab bar to match the website theme." It results in the color tones of the tabs no longer matching, even on dark websites.

before: grafik

after: grafik

bensaine commented 5 months ago

I acknowledge that this could pose an issue for some. Personally, I enjoy having the contrast even on dark sites, but maybe it is a minority preference. I could add a settable threshold [0 - 1] that controls for which contrast factors it should match the color 100%. What do you think ?

This solution breaks the main functionality of the addon: "Changes the colour of Firefox tab bar to match the website theme." It results in the color tones of the tabs no longer matching, even on dark websites.

before: grafik

after: grafik

CennoxX commented 5 months ago

I could add a settable threshold [0 - 1] that controls for which contrast factors it should match the color 100%. What do you think

I personally would prefer such a setting, but I think this is up to the addon author. I think at least the standard setting of the addon shouldn't result in missmatched colors.

bensaine commented 5 months ago

I've added a settable threshold option, it resolves the issue you mention and seems much more customizable to different user preferences.

CennoxX commented 5 months ago

Yes, this solves the problem. I'd still prefer the dark fallback color over this, but maybe others/the author @easonwong-de prefer this... The threshold options have very technical names, I still don't understand what opacity factor/threshold are.

easonwong-de commented 5 months ago

@bensaine I’ve tested it out. It’s a wonderful addition to the add-on. I’ll integrate it into the base version. Thanks for the idea, and @CennoxX also thanks for the testing.

bensaine commented 5 months ago

Nice ! After daily driving this for about a week it seems that the perfect values for most users is factor: 0.25 threshold: 0.15

bensaine commented 4 months ago

@easonwong-de any update on the release of v2.2 to the firefox store ? 😄