Assuming you are using the favicon on a webpage, you could generate a text favicon on the fly in your page. Here is how I have done that. They way I have done it is you have to give the favicon link an "id", then generate a canvas filled with colors and text.
Here is a sample webpage, showing the link with the id, the javascript function, and the javascript function being called. You may have to fiddle with the x and y coordinates and font size to get the text centered in the favicon.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Need this link in the head -->
<link id="favicon-link" rel="icon" type="image/x-icon" href="">
<!--------------------------------->
<title>Document</title>
</head>
<body>
<p>You document here</p>
<script>
//The function to make the favicon.
function makeFavicon(letters, color, backgroundColor, fontSizeInPixels, x, y) {
//put this in head of html document
//<link id="favicon-link" rel="icon" type="image/x-icon" href="">
let canvas = document.createElement('canvas');
canvas.width = 16;
canvas.height = 16;
let ctx = canvas.getContext('2d');
ctx.fillStyle = backgroundColor;
ctx.fillRect(0, 0, 16, 16);
let ctx2 = canvas.getContext("2d");
ctx2.fillStyle = color;
ctx2.font = "bold "+fontSizeInPixels.toString()+"px Arial";
ctx2.fillText(letters, x, y);
let link = document.getElementById("favicon-link");
link.href = canvas.toDataURL("image/x-icon");
}
//Call the function to make the favicon
makeFavicon("Yo", "white", "blue", 12, 1, 12);
</script>
</body>
</html>
Ideas influenced by:
https://stackoverflow.com/users/906658/bengt,
How to create a favicon in javascript?