queue/source/utilities/badge.ts

14 lines
468 B
TypeScript

import browser from 'webextension-polyfill';
import {Settings} from '../settings/settings.js';
export async function updateBadge(settings: Settings): Promise<void> {
const queueLength = settings.queue.length.toString();
await browser.browserAction.setBadgeText({
text: queueLength === '0' ? null : queueLength,
});
await browser.browserAction.setBadgeBackgroundColor({color: '#2a2041'});
browser.browserAction.setBadgeTextColor({color: '#f2efff'});
}