diff options
| author | Einar Egilsson <einar@einaregilsson.com> | 2019-12-13 10:33:41 +0000 |
|---|---|---|
| committer | Einar Egilsson <einar@einaregilsson.com> | 2019-12-13 10:33:41 +0000 |
| commit | bc1e30b743968edad31ba54e4fc95f93ee6d39ff (patch) | |
| tree | c6989fca858e6c149545adbc80814ccc264aa1da /js/redirectorpage.js | |
| parent | b473306d442b92123cf505dd634faeb141714614 (diff) | |
More dark mode issues
Diffstat (limited to 'js/redirectorpage.js')
| -rw-r--r-- | js/redirectorpage.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/js/redirectorpage.js b/js/redirectorpage.js index 30e27a9..f82b0b7 100644 --- a/js/redirectorpage.js +++ b/js/redirectorpage.js @@ -202,4 +202,16 @@ function pageLoad() { }); } + +function updateFavicon(e) { + let type = e.matches ? 'dark' : 'light' + el('link[rel="shortcut icon"]').href = `images/icon-${type}-theme-32.png`; + chrome.runtime.sendMessage({type: "update-icon"}); //Only works if this page is open, but still, better than nothing... +} + +let mql = window.matchMedia('(prefers-color-scheme:dark)'); + +mql.onchange = updateFavicon; +updateFavicon(mql); + pageLoad();
\ No newline at end of file |
