Chrome extension: programmatically setting the browser action icon causes the icon to pixelate

I tried changing the browser action icon in background.js using the following code

chrome.browserAction.setIcon({path: "img/logo-off.png", tabId:tab.id});

However, this leads to the fact that the icon will be very poorly reflected (flip flop bird style).

Has anyone had the same problem? How can I solve it?

+4
source share
1 answer

I just got access to Chrome 38 on a high DPI screen and it shows the same behavior.

DPI :

chrome.browserAction.setIcon({
  path: {
    19: "img/logo-off.png",
    38: "img/logo-off-hidpi.png"
  },
  tabId: tab.id
});

Chrome DPI. 19x19 38x38.

( 2016):

Chrome, , Material Design , 16x16 (32x32 HiDPI). , ( Linux, ).

+6

All Articles