【问题标题】:responsive chrome extension icons响应式 chrome 扩展图标
【发布时间】:2020-06-02 13:33:37
【问题描述】:

所以 google chrome 扩展程序现在需要 16x16、19x19、38x38、48x48 和 128x128 像素大小的图标。

我已将图标包含在我的压缩文件中,但是如何调整我的代码以使图标具有响应性并显示正确的大小。

目前我有以下指向图标图像的代码:

`if(toggle.checked)

{
    chrome.browserAction.setIcon({path:"green_icon.png"
});`
    else
{
    chrome.browserAction.setIcon({path:"red_icon.png"
});

显然,这段代码是在只有一种图像大小的基础上工作的,所以我认为需要重构我的代码以使其具有响应性?但我找不到任何关于此的谷歌指南。

非常感谢任何建议。

谢谢

【问题讨论】:

标签: javascript google-chrome google-chrome-extension responsive-design responsive


【解决方案1】:

您是否尝试过定义对象内部的大小?

if(toggle.checked)
{
    chrome.browserAction.setIcon({
       path : {
         //Obviously you can change the pixel size to whatever you want
         "38": "green_icon.png"
       }
    });
} else {
    chrome.browserAction.setIcon({
       path : {
         //Obviously you can change the pixel size to whatever you want
         "38": "red_icon.png"
       }
    });
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-03-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多