* add @redux/toolkit * bump react version to allow for hooks * add remote-redux devtools to help track extension state * add remote-redux server to allow for remote state viewing * setup react-redux for current user * setup watch mode for running redux remote dev watch to options * move screenshots
29 lines
746 B
TypeScript
29 lines
746 B
TypeScript
import { browser } from 'webextension-polyfill-ts';
|
|
import config from '../config/config';
|
|
|
|
type ColorIconTypes = 'gray' | 'red' | 'white' | '';
|
|
|
|
/**
|
|
* It changes the extension icon color.
|
|
*/
|
|
export default async function changeExtensionIcon(color?: ColorIconTypes): Promise<void> {
|
|
if (color) {
|
|
const path = `./graphics/wakatime-logo-38-${color}.png`;
|
|
|
|
await browser.browserAction.setIcon({
|
|
path: path,
|
|
});
|
|
} else {
|
|
const { theme } = await browser.storage.sync.get({
|
|
theme: config.theme,
|
|
});
|
|
const path =
|
|
theme === config.theme
|
|
? './graphics/wakatime-logo-38.png'
|
|
: './graphics/wakatime-logo-38-white.png';
|
|
await browser.browserAction.setIcon({
|
|
path: path,
|
|
});
|
|
}
|
|
}
|