Neat-URL icon indicating copy to clipboard operation
Neat-URL copied to clipboard

Support adaptive theming for icon

Open jonalmeida opened this issue 3 years ago • 2 comments

Firefox uses adaptive theming which can change depending on the system theme or time of day. Manually changing the icon is tedious and results in the icon hard to see when the opposite theme is used.

For example, light theme with the light icon is very hard to see (theme: the new Firefox Alpenglow):

Screen Shot 2021-07-12 at 3 06 18 PM

jonalmeida avatar Jul 12 '21 19:07 jonalmeida

Thank you for your idea.

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/theme/getCurrent browser.theme.getCurrent() seems to return an object with a color code, for example

"theme": {
  "images": {
    "theme_frame": "images/sun.jpg"
  },
  "colors": {
    "frame": "#CF723F",
    "tab_background_text": "#000"
  }
}

Using theme.colors.tab_background_text is probably the easiest.

Option two: perceived brightness (based on theme.colors.frame) might help as well. https://stackoverflow.com/questions/12043187/how-to-check-if-hex-color-is-too-black

Smile4ever avatar Feb 03 '22 14:02 Smile4ever

@Smile4ever I haven't worked on addons, but it looks like you can declare your icons for the two different themes types in your manifest.json: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action#Syntax

jonalmeida avatar Feb 03 '22 17:02 jonalmeida