chrome extension - how to print value instead of icon

Nick

I wrote a chrome extension, and it works properly.

My extension is nothing more than a counter. At the moment, I have to click on the extension icon to see the counter result.

I'd like to have it printed in the bar instead of having to click on an icon to see the result. Is it possible?

I wasn't able to find anything on that, so any help will be really appreciated.

Sorry for not posting here any code, but i don't really think it's necessary for this question.

thanks

Xan

The easiest way to do it is to use badges next to the icon.

That's how they look: Browser action badge

To set a badge for your extension's icon (assuming it's a Browser Action):

chrome.browserAction.setBadgeText({text: "1"});
chrome.browserAction.setBadgeBackgroundColor({color: [255, 255, 0, 255]}); // RGBA array
chrome.browserAction.setBadgeBackgroundColor({color: "#FFFF00"}); // CSS value

This can also be done per-tab; see the documentation for more info.


If you really want to change your icon, you can draw whatever you want on a <canvas> element and update your icon with chrome.browserAction.setIcon() using imageData format. Here's an example.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

chrome extension - how to print value instead of icon

From Dev

chrome extension icon is not changing

From Dev

chrome extension icon is not changing

From Dev

How to open a mailto link with a click on a Chrome extension icon?

From Dev

Chrome extension icon in search result

From Dev

Make an animated Chrome extension icon?

From Dev

Chrome Extension icon not having color

From Dev

Make an animated Chrome extension icon?

From Dev

Chrome extension with content script on extension icon

From Dev

Chrome extension with content script on extension icon

From Dev

How do I specify an Chrome Extension icon (popup icon) for Retina Mac's

From Dev

Unable to set an action extension icon, grey icon instead

From Dev

Recommended size of icon for Google Chrome Extension

From Dev

Chrome 33.0.1750.117 m, background icon extension is orange

From Dev

Chrome extension: Add content (enable/disable icon)

From Dev

Chrome 33.0.1750.117 m, background icon extension is orange

From Dev

Access icon image from html in chrome extension

From Dev

Chrome Extension: Programmatically setting browser action icon causes the icon to pixelate

From Dev

How do i print Variable name instead of the value assigned to the variable?

From Dev

how can i print var name instead var value in PHP?

From Dev

Google Chrome Extension: Cannot launch Print dialog

From Dev

Chrome is exporting wrong "file extension" instead of xls

From Dev

Chrome is exporting wrong "file extension" instead of xls

From Dev

Chrome Extension: How to create context menu with custom name, instead of plugin name

From Dev

How can you configure Chrome to show Extension icons in multiple rows instead of one?

From Dev

How can I make a Chrome Extension open an external page instead of the defualt popup.html

From Dev

Chrome extension icon has a yellow / orange highlighted background / border

From Dev

Adding drop-down menu to chrome extension icon

From Dev

Disable / Enable Chrome Extension Via Browser Action / Icon

Related Related

  1. 1

    chrome extension - how to print value instead of icon

  2. 2

    chrome extension icon is not changing

  3. 3

    chrome extension icon is not changing

  4. 4

    How to open a mailto link with a click on a Chrome extension icon?

  5. 5

    Chrome extension icon in search result

  6. 6

    Make an animated Chrome extension icon?

  7. 7

    Chrome Extension icon not having color

  8. 8

    Make an animated Chrome extension icon?

  9. 9

    Chrome extension with content script on extension icon

  10. 10

    Chrome extension with content script on extension icon

  11. 11

    How do I specify an Chrome Extension icon (popup icon) for Retina Mac's

  12. 12

    Unable to set an action extension icon, grey icon instead

  13. 13

    Recommended size of icon for Google Chrome Extension

  14. 14

    Chrome 33.0.1750.117 m, background icon extension is orange

  15. 15

    Chrome extension: Add content (enable/disable icon)

  16. 16

    Chrome 33.0.1750.117 m, background icon extension is orange

  17. 17

    Access icon image from html in chrome extension

  18. 18

    Chrome Extension: Programmatically setting browser action icon causes the icon to pixelate

  19. 19

    How do i print Variable name instead of the value assigned to the variable?

  20. 20

    how can i print var name instead var value in PHP?

  21. 21

    Google Chrome Extension: Cannot launch Print dialog

  22. 22

    Chrome is exporting wrong "file extension" instead of xls

  23. 23

    Chrome is exporting wrong "file extension" instead of xls

  24. 24

    Chrome Extension: How to create context menu with custom name, instead of plugin name

  25. 25

    How can you configure Chrome to show Extension icons in multiple rows instead of one?

  26. 26

    How can I make a Chrome Extension open an external page instead of the defualt popup.html

  27. 27

    Chrome extension icon has a yellow / orange highlighted background / border

  28. 28

    Adding drop-down menu to chrome extension icon

  29. 29

    Disable / Enable Chrome Extension Via Browser Action / Icon

HotTag

Archive