Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

Przeszukaj pomoc

Unikaj oszustw związanych z pomocą.Nigdy nie będziemy prosić Cię o dzwonienie na numer telefonu, wysyłanie SMS-ów ani o udostępnianie danych osobowych. Zgłoś podejrzaną aktywność, korzystając z opcji „Zgłoś nadużycie”.

Learn More

Add-on dev: How can I edit Firefox UI CSS?

  • 2 odpowiedzi
  • 1 osoba ma ten problem
  • 1 wyświetlenie
  • Ostatnia odpowiedź od cor-el

more options

I'm developing an add-on for Firefox which will take the colors from the favicon of the current tab to color bits of the tab-bar dynamically.

I'm having trouble finding out how I can modify browser CSS, for example in the Browser Tool box console, this works perfectly fine: ```const activeTab = document.querySelector('.tabbrowser-tab[selected="true"] .tab-background'); activeTab.style.background = "rgb(0, 221, 255)";```

but when inputting this same code in my add-on, it cannot query that same selector (I've given it tabs and theme permissions). This also does not work as a stylesheet.

Can anyone point me to what I need to access the browser UI DOM?

I'm developing an add-on for Firefox which will take the colors from the favicon of the current tab to color bits of the tab-bar dynamically. I'm having trouble finding out how I can modify browser CSS, for example in the Browser Tool box console, this works perfectly fine: ```const activeTab = document.querySelector('.tabbrowser-tab[selected="true"] .tab-background'); activeTab.style.background = "rgb(0, 221, 255)";``` but when inputting this same code in my add-on, it cannot query that same selector (I've given it tabs and theme permissions). This also does not work as a stylesheet. Can anyone point me to what I need to access the browser UI DOM?

Wszystkie odpowiedzi (2)

more options

Hi

You may wish to ask about this issue in the add-on developers forum at:

https://discourse.mozilla.org/c/add-ons/35

more options

Web extensions can't access content in the user interface like the Tab bar, they can only interact with webpage content. You can't do this via an extension, this can only be done via userChrome.css.