Chrome扩展程序图标没有颜色

时间:2016-04-29 19:25:38

标签: google-chrome-extension

我刚创建了第一个Chrome扩展程序。我的扩展程序图标在扩展程序管理器页面中正确显示(带颜色): Icon with color

但Chrome在扩展栏中显示了我的图标的灰度版本: Icon without color

这是我的扩展的清单:

{
  "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
    }
  ]
}

如何让Chrome在地址栏旁边显示带有颜色的图标?

由于

2 个答案:

答案 0 :(得分:11)

这是奇怪的行为,我不知道为什么会这样,但我知道解决方案:你应该使用public static void main(String[] args) { List<Entity> representations = new ArrayList<>(); representations.add(new Entity("foo", "baz", false)); representations.add(new Entity("foo1", "baz1", true)); representations.add(new Entity("foo2", "baz2", false)); Response build = Response.ok(representations).build(); printEntitesFromResponse(build); } public static void printEntitesFromResponse(Response response) { response .readEntity(new GenericType<List<Entity>>() {}) .stream() .forEach(entity -> System.out.println(entity)); } 代替default_icon

icon

请注意,图标需要为19x19或38x38像素。

您已正确定义了较大的图标,因此可以保留原样。

有关详细信息,请参阅here

答案 1 :(得分:0)

根据我的经验和Noam的回答,我很想说这是因为你的扩展没有定义"browser_action"。换句话说:它的图标显示它已安装,但它没有做任何事情,所以它的颜色已被删除。

这只是一个未经任何文档或测试确认的猜测。

相关问题