Skip to content

maxkostinevich/Cloudflare-Favicon-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fav


Serverless Favicon Generator

A simple serverless function which generates a Github-like favicon to be hosted on Cloudflare Workers. Inspired by Identicon.js

Usage

Just add link to function to your website:

<link
      rel="icon"
      type="image/png"
      sizes="32x32"
      href="https://fav.frontier.workers.dev/"
    />

You can also pass the following parameters:

  • hash - pass this parameter if you'd like to get the same favicon on each request. This is a hashed string (min 15 char length), for example - you may use md5 of your domain name;
  • fg - hex of foreground color, excluding #, e.g. FF0000
  • bg - hex of background color, excluding #, e.g. FF0000

For example:

<link
      rel="icon"
      type="image/png"
      sizes="32x32"
      href="https://fav.frontier.workers.dev/?hash=3f07179a07b2a7661e37a3fd0e652a07&fg=1D1F20&bg=F4A15D"
    />

Deploy your own instance

You may deploy this function to your own Cloudflare Workers account.

To do this, make sure CF Wrangler is installed and configured on your machine, and run wrangler publish in your console.


(c) 2020 Max Kostinevich - All rights reserved.