diff --git a/source/utilities/badge.ts b/source/utilities/badge.ts index e4af20a..5125d94 100644 --- a/source/utilities/badge.ts +++ b/source/utilities/badge.ts @@ -3,11 +3,21 @@ import browser from 'webextension-polyfill'; import {Settings} from '../settings/settings.js'; export async function updateBadge(settings: Settings): Promise { + let action: browser.Action.Static = browser.browserAction; + if (import.meta.env.VITE_BROWSER === 'chromium') { + action = browser.action; + } + const queueLength = settings.queue.length.toString(); - await browser.browserAction.setBadgeText({ - text: queueLength === '0' ? null : queueLength, + await action.setBadgeText({ + text: queueLength === '0' ? '' : queueLength, }); - await browser.browserAction.setBadgeBackgroundColor({color: '#2a2041'}); - browser.browserAction.setBadgeTextColor({color: '#f2efff'}); + await action.setBadgeBackgroundColor({ + color: '#2a2041', + }); + + if (import.meta.env.VITE_BROWSER === 'firefox') { + action.setBadgeTextColor({color: '#f2efff'}); + } }