如何更改Chrome扩展程序中的默认图标? [英] how I can change default icon in chrome extension?
问题描述
在这里,我正在开发chrome扩展程序.
Here I am working with chrome extension development.
我的manifest.json页面显示为
my manifest.json page as show
{
"name": "DemoExtension",
"version": "1.0",
"description": "Official addon from demeo",
"browser_action": {
"default_icon": "star-on.png",
"popup": "shopcmp.htm"
},
"permissions": [
"tabs"
],
"background_page": "background.html"
}
在这里,我想在运行时更改默认图标图像.
Here I want to change my default icon image at runtime.
推荐答案
如果要更改浏览器操作默认图标,只需更改
If you want to change the browser action default icon, just change
"browser_action": {
"default_icon": "star-on.png", //<--this line: change "star-on.png" to the icon you want
"popup": "shopcmp.htm"
},
该行表示首次加载扩展程序时的默认图标.
要更改代码中的图标 ,请调用 chrome.browserAction.setIcon(details)
.
That line indicates the default icon on first load of the extension.
To change the icon in code, call chrome.browserAction.setIcon(details)
.
如果要更改扩展程序图标(在安装过程中,Chrome Web Store中,扩展程序管理页面中以及作为图标显示的图标),请添加
If you want to change the extension icon (the icons that shows during installation, in the Chrome Web Store, in the extension management page, and as a favicon), add an icons
property to your manifest.json file.
这篇关于如何更改Chrome扩展程序中的默认图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!