diff options
| author | Shpuld Shpuldson <shp@cock.li> | 2020-11-02 16:45:15 +0200 |
|---|---|---|
| committer | Shpuld Shpuldson <shp@cock.li> | 2020-11-02 16:45:15 +0200 |
| commit | 1fa046126eb8a048440ff97be8febe3a8c6e6e58 (patch) | |
| tree | 0e1366fd7fe1cd6789a3f7d6f14b1ed697aa1c3c /src | |
| parent | 350eb489c22e6bac20de92284193a87af63c52a9 (diff) | |
make badge just a ball, make it use theming
Diffstat (limited to 'src')
| -rw-r--r-- | src/services/favicon_service/favicon_service.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/services/favicon_service/favicon_service.js b/src/services/favicon_service/favicon_service.js index 8e3f1170..5fa8e5c3 100644 --- a/src/services/favicon_service/favicon_service.js +++ b/src/services/favicon_service/favicon_service.js @@ -4,9 +4,7 @@ const createFaviconService = () => { let favimg, favcanvas, favcontext, favicon const faviconWidth = 48 const faviconHeight = 48 - const strokeColor = 'rgb(200, 0, 0)' - const fillColor = 'rgb(255, 90, 90)' - const badgeRadius = 12 + const badgeRadius = 14 const initFaviconService = () => { const nodes = document.getElementsByTagName('link') @@ -34,13 +32,14 @@ const createFaviconService = () => { clearFaviconBadge() + const style = getComputedStyle(document.body) + const badgeColor = `${style.getPropertyValue('--badgeNotification') || 'rgb(240, 100, 100)'}` + favcontext.drawImage(favimg, 0, 0, favimg.width, favimg.height, 0, 0, faviconWidth, faviconHeight) - favcontext.fillStyle = fillColor - favcontext.strokeStyle = strokeColor + favcontext.fillStyle = badgeColor favcontext.beginPath() - favcontext.arc(faviconWidth - badgeRadius, faviconHeight - badgeRadius, badgeRadius, 0, 2 * Math.PI, false) + favcontext.arc(faviconWidth - badgeRadius, badgeRadius, badgeRadius, 0, 2 * Math.PI, false) favcontext.fill() - favcontext.stroke() favicon.href = favcanvas.toDataURL('image/png') } |
