Addon help: meta name="theme-color"

I’m trying to make an addon that changes the firefox theme to the color of the
meta name=“theme-color” tag, like chrome mobile does.

I was able to:

  • make a content script that gets the websites theme color specified in the meta name=“theme-color” tag.
  • make a background script to changed the theme color.
    But I was unable to do both action in the same script.

So is there a way to:

  • get the websites theme color and change the firefox theme in one script.
  • let the 2 scripts communicate, so I can get the websites theme color in the content script and send it to the background script who then changed the firefox theme color?

Thanks for helping me with my first addon!

browser.runtime.sendMessage and friends.

Edit:
I just remembered, if you run your content script to get the color from the page using tabs.executeScript you will also get the value of the last thing in the script body - I recall doing this when I attempted something similar.

Thanks!

I used the executeScript and it works!

It’s not finished yet, but the hardest part is over, thanks!