Search code examples
google-chrome-extension

Chrome Extension Badge - Text Color


A quick question regarding the Chrome Badge/Browser Action API. Is there a method to set the badge text colour? (much like you can with the back colour). I'm sure I remember seeing a reference to a method such as SetBadgeTextColor() somewhere on the Internet (not sure where, mind).

Edit: Chromium Wiki - Browser Actions Proposal

The link above is where I saw a method to set the badge text colour. Was this proposal ever implemented?


Solution

  • You cannot change the text color directly.

    What you can do is to paint the base image on a canvas, then draw the text using your desired color and finally use chrome.browserAction.setIcon to update the badge.