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