M-Reimer / undoclosetab

Undo Close Tab Add-on for Firefox
GNU General Public License v3.0
92 stars 16 forks source link

[Feature Request] Add option to manually set the svg color #92

Open heiwiper opened 3 years ago

heiwiper commented 3 years ago

When using Apenglow theme the addon icon takes the white theme svg color by default even if the dark variant of the theme is used.

image

Fixing this would require either automatically detecting that the dark theme variant is used or add an option to manually set the color.

M-Reimer commented 3 years ago

I would prefer to not have something like this. After all it is a tool to restore a tab and not to style a button. Maybe after that another user requests a file picker to choose his own custom icon.

Actually this whole situation is REALLY broken. All I want to have is a icon which matches nearly perfectly between the existing icons. And Mozilla really does all the best to make this as difficult as possible as all they have is a way to place a maximum of two icons. "Standard" and "Dark". What I do is hooking into a theming API to get notified if a theme changes and listen to what colors the new theme sets. And it seems like something is wrong there.

I will have a look into this at some point. Thanks for linking the theme. But my first guess is that after debugging I probably will find out that this is a bug in Firefox itself. Of course I would report this with all the information I can give but I'm not too confident that it will be fixed within short time.

Just to verify a first idea: Did you try to switch to this "dark theme" and then restart Firefox? This would be the easiest one if just the "theme switched" event is missing but the correct color is actually communicated. Maybe this would be fixed upstream a bit faster (as it's easy) and it would be possible to workaround this with a time-delayed polling mechanism.

heiwiper commented 3 years ago

I have tried what you suggested but it doesn't seem to work, I don't know how this theme works but It seems like it has the light variant as default theme because It wasn't supported on Linux until 2 months ago and I remember trying it before that and having the light variant despite having dark theme enabled on Linux.

M-Reimer commented 3 years ago

How do you even switch to "the dark variant"? I can't find any way to switch.

M-Reimer commented 3 years ago

Found it. I would have to set my system global theme to "dark" (which I don't want to do. I want my browser in dark mode but prefer to have the rest of the system in "default light" mode).

If I do so, then the theme switches but no "onUpdated" event is sent to my Add-on at all. This means that Mozilla "forgot" to update the WebExtensions backend when adding their "dark_theme" manifest entry.

Delaying this for being an upstream bug for now. I would rather try to fix this directly in Firefox and getting a patch done to provide to Mozilla than creating just another silly workaround. I already have plenty of workarounds in my Add-on...

For future reference: This Issue is blocked by: https://bugzilla.mozilla.org/show_bug.cgi?id=1542044

heiwiper commented 3 years ago

I have just installed this add-on today and it seemed like it doesn't have the same problem, I looked up on their GitHub and apparently this pull request addresses the issue, I would love to try it on this add-on and see if it works but I'm not that good in JS and CSS and I don't really know the structure of your project so I don't know where I would start.

M-Reimer commented 3 years ago

This is a "Mozilla Add-on" and Mozilla has itself created some kind of "privileged" technique to allow this, which is called "context-fill". And Mozilla refuses to enable this to all Add-ons. They have a whitelist which only allows their own Add-ons to use it.

https://bugzilla.mozilla.org/show_bug.cgi?id=1394579

We have to live with the fact that Mozilla doesn't want to offer such features to all developers but only want to use this for their own work.

Actually the whole Add-on development process for Firefox is pretty much based around creative workarounds to hide limitations of their API from users... :disappointed:

heiwiper commented 3 years ago

Oh I see :cry:

massic80 commented 2 years ago

Hi, I get a similar problem on 106.0b7: it asked me whethere I wanted to switch to one of its "romantic" themes, and I chose Blue "Activist". I kept that for some days, then I reset it to default, bright one. Now UndoCloseTab icon is white and it's invisible on the very-light-gray toolbar. Shall I really force system's dark-light theme? Sidenote: disabling and immedately re-enabling the addon, the icon gets visible again.