summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-03-09 18:54:16 +0300
committerAndrew Dolgov <[email protected]>2021-03-09 18:54:16 +0300
commit28d25c25774c4c2a6bfb2f534cfcf53d8b3cc811 (patch)
treea098f6146b745e3a79fead3f2f83df6c352ef166
parent46847fd112b3c56f383af9ed2808e8451957bede (diff)
use higher-resolution rendering
-rw-r--r--init.js21
1 files changed, 12 insertions, 9 deletions
diff --git a/init.js b/init.js
index d3e5891..0210c4a 100644
--- a/init.js
+++ b/init.js
@@ -5,8 +5,8 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
function updateFaviconBadge(unread = 0, fresh = 0) {
const canvas = document.createElement('canvas');
- canvas.width = 16;
- canvas.height = 16;
+ canvas.width = 72;
+ canvas.height = 72;
if (canvas.getContext) {
const link = App.find("link[rel='shortcut icon']");
@@ -19,25 +19,28 @@ require(['dojo/_base/kernel', 'dojo/ready'], function (dojo, ready) {
let bg_color = "#257aa7";
let count = unread;
+ let font_size = "42px";
if (fresh > 0) {
count = fresh;
- bg_color = "#25a738";
+ bg_color = "#3ea447";
}
- if (count > 99)
- count = 99;
+ if (count > 99) {
+ count = "∞";
+ font_size = "52px";
+ }
ctx.fillStyle = bg_color;
- ctx.fillRect(0, 0, 16, 16);
+ ctx.fillRect(0, 0, 72, 72);
ctx.fillStyle = 'white';
- ctx.font = 'bold 10px sans-serif';
+ ctx.font = `bold ${font_size} Segoe UI, sans-serif`;
ctx.textAlign = 'center';
- ctx.fillText(count, 8, 11);
+ ctx.fillText(count, 36, 50);
} else {
- ctx.drawImage(img, 0, 0, 16, 16);
+ ctx.drawImage(img, 0, 0, 72, 72);
}
link.type = 'image/x-icon';