Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome Extension icon not having color

I just create my first Chrome extension. My extension's icon shows correctly (with color) in the extension manager page: Icon with color

But Chrome shows a grayscale version of my icon in the extension bar: Icon without color

Here's the manifest of my extension:

{
  "name": "__MSG_appName__",
  "version": "0.0.1",
  "manifest_version": 2,
  "description": "__MSG_appDescription__",
  "icons": {
    "16": "images/icon-16.png",
    "128": "images/icon-128.png"
  },
  "default_locale": "en",
  "background": {
    "scripts": [
      "scripts/chromereload.js",
      "scripts/background.js"
    ]
  },
  "permissions": [
    "tabs",
    "http://*/*",
    "https://*/*",
    "contentSettings"
  ],
  "content_scripts": [
    {
      "matches": [
        "http://*/*",
        "https://*/*"
      ],
      "js": [
        "scripts/contentscript.js"
      ],
      "run_at": "document_end",
      "all_frames": false
    }
  ]
}

What can I do to make Chrome show my icon with color next to the address bar?

Thanks

like image 365
Thang Coder Avatar asked Apr 29 '16 19:04

Thang Coder


People also ask

Why is my extension greyed out?

If you see a message saying "Extensions Disabled," it's because Chrome has turned off one or more of your extensions to keep your data safe while you're browsing the Internet. The extensions that Chrome turned off either didn't come from the Chrome Web Store or were determined unsafe.

How do I change the icon for a Chrome extension?

To the right of your address bar, find your extensions' icons. On your computer, open Chrome. Drag the extension's icon to its new place.

How do I find the color code of an extension?

Install Color Picker extension from Chrome store. After installing visit any webpage from where you want to grab a color code. Then click on the extension icon and it will enable the color picker cusror icon. Now tap on the desired point and it will give you the info of that color code in HEX and RGB options.


2 Answers

That is odd behaviour, I don't know why it's happening but I know the solution: you should be using default_icon instead of icon:

"browser_action": {
    "default_icon": "icon.png"
}

Note that the icon needs to be 19x19 or 38x38 pixels.

You've defined the larger icon correctly though so you could leave that as is.

See here for more info.

like image 150
Noam Hacker Avatar answered Oct 11 '22 20:10

Noam Hacker


Based on my experience and on Noam's answer I'm tempted to say that it is because your extension doesn't have a "browser_action" defined. In other words: its icon is there to show it is installed, but it doesn't do anything, so it had its colors removed.

This is just a guess not confirmed by any documentation or test.

like image 34
fiatjaf Avatar answered Oct 11 '22 19:10

fiatjaf