Helper for displaying badges in chrome.action
API.
You can install this library using npm:
npm install chrome-badge
Sets the text color and background color for badge of the action. The badge is displayed on top of the icon.
import { Badge } from "chrome-badge";
const text = "999";
const backgroundColor = "red";
const textColor = "white";
Badge.set({ text, textColor, backgroundColor });
Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned.
import { Alarm } from "chrome-alarms";
const badge = await Badge.get();
console.log(badge);
// Output:
// Object{
// backgroundColor: Array(4) [255, 0, 0, 255],
// text: "999",
// textColor: Array(4) [255, 255, 255, 255]
// }
This project is licensed under the MIT License - see the LICENSE file for details.