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
311 stars 12 forks source link

Some site's colors are too bright, even with prefer dark mode on & allow light tab bar off #29

Open Freeplayg opened 2 years ago

Freeplayg commented 2 years ago

Example from Mastodon: image

Freeplayg commented 2 years ago

Actually, maybe instead add the option to ignore the site's theme color, and just use the website's background color?

easonwong-de commented 2 years ago

Hello!

As a matter of fact, another user also wanted to change the threshold of dark/light color in #27, but in the opposite way: they wanted the add-on to classify more colors as dark color. Now, the add-on decides whether a color is bright or dark (affects text color) in this way: brightness = 0.299 × r + 0.587 × g + 0.114 × b; if brightness > 128, then color is bright; otherwise is it dark. This procedure is based on science and might not be changed in the foreseeable future.

If you don’t like the theme color, please open settings page of the add-on (open pop-up, and click “More settings…”), turn on “Set color for specific domains”. Then you may click “Add” symbol at the end of the list, paste the domain to replace “example.com”, and then choose “ignore theme color” in the dropdown menu. (In future version it’ll be easier to do)

Hope this solves your problem.

CennoxX commented 1 year ago

It would be great, if this threshold of currently 128 could be set in the preferences.

Erudition commented 3 weeks ago

brightness = 0.299 × r + 0.587 × g + 0.114 × b; if brightness > 128, then color is bright; otherwise is it dark. This procedure is based on science and might not be changed in the foreseeable future.

I can imagine 2 alternatives that might end up being better:

  1. Convert the color to Oklch and use the lightness from that - the lab color space is better anyway, but it's ideal for this since the perceived brightness is right there in the data - whereas rgb brightness is inconsistent depending on the color.
  2. Use a good color contrast algorithm to compare the contrast of the color on the designated "dark" color vs. the designated "light" color.