fix favicon size
This commit is contained in:
@@ -4,8 +4,6 @@ let tabIcons = {};
|
||||
|
||||
var changeIcon = function(color, currentIcon, options) {
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = 16;
|
||||
canvas.height = 16;
|
||||
var ctx = canvas.getContext('2d');
|
||||
var img = new Image();
|
||||
|
||||
@@ -16,12 +14,14 @@ var changeIcon = function(color, currentIcon, options) {
|
||||
}
|
||||
|
||||
img.onload = function() {
|
||||
canvas.width = this.naturalWidth;
|
||||
canvas.height = this.naturalHeight;
|
||||
ctx.drawImage(img, 0, 0);
|
||||
ctx.fillStyle = color;
|
||||
if (options.globals.orientation === 'vertical') {
|
||||
ctx.fillRect(0, 0, options.globals.width, 16);
|
||||
ctx.fillRect(0, 0, (options.globals.width / 16) * canvas.width, canvas.height);
|
||||
} else {
|
||||
ctx.fillRect(0, 0, 16, options.globals.width);
|
||||
ctx.fillRect(0, 0, canvas.width, (options.globals.width / 16) * canvas.height);
|
||||
}
|
||||
|
||||
var link = document.createElement('link');
|
||||
|
Reference in New Issue
Block a user