uBlockOrigin / uBlock-issues

This is the community-maintained issue tracker for uBlock Origin
https://github.com/gorhill/uBlock
945 stars 81 forks source link

Support for Firefox theme colors #2398

Open MorsMortium opened 1 year ago

MorsMortium commented 1 year ago

Prerequisites

I tried to reproduce the issue when...

Description

Firefox has an api theme.getCurrent. This returns the current themes colors, or an empty result, when no theme is selected. It would be nice, if there was a setting, that would allow the addon to use these colors, changing the addons every popups colors, blending in with the browser.

A specific URL where the issue occurs.

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/theme/getCurrent

Steps to Reproduce

  1. Click on uBlockOrigin icon

Expected behavior

Either use theme colors, if they are available, under Firefox, or expose a setting that would enable this.

Actual behavior

The popup has different colors from the Firefox theme and there is no option to change this.

uBO version

1.45.2

Browser name and version

Firefox 107.0

Operating System and version

Manjaro Linux 21.3.7

gorhill commented 1 year ago

I am going to decline this.

You provide no details of what theme color(s) should apply to which uBO's visuals -- along with specific themes as examples. I installed a few themes, and I also didn't see Firefox's own extensions or other Firefox visual (hamburger menu, Settings page, etc.) being affected by the theme, so uBO is not standing out as being the exception, and if anything, it at least does follow the color-scheme dictated by the theme.

MorsMortium commented 1 year ago

Firefox alpenglow theme: Screenshot_20230101_172857 My addon: Screenshot_20230101_173016 Colorway playmaker bold: Screenshot_20230101_173458 My addon: Screenshot_20230101_173542 Colorway visionary bold: Screenshot_20230101_173644 My addon: Screenshot_20230101_173734 There are 3 main colors: background color, highlight color and text color. From the provided theme only 2 values are needed for these 3: colors.popup_text, colors.popup. Text color is colors.popup_text, background color is colors.popup and highlight color is colors.popup_text with 17% alpha, from my own testing. One extra color used by Firefox popups is the separator, that uses colors.popup_border.

gorhill commented 1 year ago

As this would require uBO to declare a new theme permission in the manifest, I prefer to decline.

MorsMortium commented 1 year ago

From this article: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/theme it seems that key is for applying a theme to firefox (Use the theme key to define a static theme to apply to Firefox.) The extension I made (in the example images) Uses the API, without the manifest key, which I think wouldn't be possible, if the API needed the key. You can take a look at my extension here: https://codeberg.org/MorsMortium/Synclair