When visiting GitHub using a browser without color emoji support, it loads emoji glyphs as image files.
But when visiting GitHub using a browser that does have color emoji support, it lets the browser render the glyphs normally instead.
How can GitHub know whether the browser supports color emoji or not?
I do that like this :
var canvas = document.createElement("canvas"),
ctx = canvas.getContext("2d");
canvas.style="height:100px;width:100px;position:absolute;top:60%;background:white";
document.body.appendChild(canvas);
ctx.fillStyle ="#FFF";
ctx.font="100px Arial";
ctx.fillText('😡',100,100);
var d = ctx.getImageData(50, 50, 1, 1).data;
if (d[0] + d[1] + d[2] === 0) {
//need twemoji or something else
} else {
//nothing to do
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With