diff --git a/extension/README.md b/extension/README.md index 0961173..9cedf60 100644 --- a/extension/README.md +++ b/extension/README.md @@ -1,5 +1,8 @@ - manifest version: both chrome and firefox store versions are on manifest v3 now +# Icon +Icon is from https://www.freepik.com/icon/unicorn_14284894, scaled a bit up with `convert unicorn.png -resize 110% -gravity center -background none -extent 128x128 unicorn2.png` + # permissions used See main `README.md`. diff --git a/extension/generate_manifest.js b/extension/generate_manifest.js index 697123a..eb5ec04 100644 --- a/extension/generate_manifest.js +++ b/extension/generate_manifest.js @@ -109,12 +109,6 @@ export function generateManifest({ content_scripts.push({"matches": [""], "js": ["selenium_bridge.js"]}) } - // FIXME ugh... - // this will basically require "Reads data on all sites" permission - // and seems like all other methods for detecting it (e.g. listener on popup page/offscreen page don't work reliably) - // https://stackoverflow.com/a/77806811/706389/ - content_scripts.push({"matches": [""], "js": ["detect_dark_mode.js"]}) - const manifest = { name: pkg.name + (release ? '' : ' [dev]'), version: pkg.version, diff --git a/extension/rollup.config.js b/extension/rollup.config.js index dcdeda3..75195fa 100644 --- a/extension/rollup.config.js +++ b/extension/rollup.config.js @@ -113,6 +113,5 @@ export default [ path.join(srcDir, 'background.ts'), path.join(srcDir, 'options_page.ts'), path.join(srcDir, 'popup.ts'), - path.join(srcDir, 'detect_dark_mode.ts'), ]), ] diff --git a/extension/src/background.ts b/extension/src/background.ts index 6d379da..a167ccf 100644 --- a/extension/src/background.ts +++ b/extension/src/background.ts @@ -186,13 +186,6 @@ browser.runtime.onMessage.addListener((_message: unknown, sender: Runtime.Messag }) return true // means 'async response' } - if (message.method == 'DARK_MODE') { - const icon_path = message.hasDarkMode ? 'img/unicorn_dark.png' : 'img/unicorn.png' - - // manifest v2 doesn't have browser.action - const action = browser.action ? browser.action : browser.browserAction - action.setIcon({path: icon_path}) - } }) diff --git a/extension/src/detect_dark_mode.ts b/extension/src/detect_dark_mode.ts deleted file mode 100644 index ee8642c..0000000 --- a/extension/src/detect_dark_mode.ts +++ /dev/null @@ -1,10 +0,0 @@ -const hasDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches - -// TODO this won't be typechecked though.. maybe need to make it TS aware only? -// or maybe fine to import browser here, just remove unused stuff to keep content script small? - -// @ts-expect-error browser should be available in browser context -chrome.runtime.sendMessage({ - method: 'DARK_MODE', - hasDarkMode: hasDarkMode, -}) diff --git a/extension/src/img/unicorn.png b/extension/src/img/unicorn.png index 1e97bbc..2cf807e 100644 Binary files a/extension/src/img/unicorn.png and b/extension/src/img/unicorn.png differ diff --git a/extension/src/img/unicorn_dark.png b/extension/src/img/unicorn_dark.png deleted file mode 100644 index 3ec03a9..0000000 Binary files a/extension/src/img/unicorn_dark.png and /dev/null differ