Honk Avatars are Perfect

published: [nandalism home] (dark light)


Honk is a federated micro-blogging system based on ActivityPub. Written in golang by Ted Unangst.


Honk has a visionary approach to visual avatars. Unangst asks, and answers, this question.
What if all avatars were a 4x4 square grid of purple shades?
And there it is! All problems solved at a single, genius stroke. The individual blocks (or hocks as Unangst styles them) have their purple hue derived by a trivial function of the hash of the user's name. I won't go into the details here. Just look at one and it will be intuitively obvious how it was created.


Since the inception of his project Unangst has been hounded by a dogged few of the ignoranti with demands to introduce "normal" avatar images. Luckily all are not so blind to the advantages Unangst has provided to us.


It is with great regret, therefore, that I include a small patch to the Honk sources which provide a very simplistic, but serviceable implementation of image avatars for Honk.

You must understand I do this only as a favor to a friend of the family; named Kano if it is of interest. Please feel free, as I'm sure you must, to ignore this defilement of the original Honk source code.

Instructions for Kano on Use

This assumes that you have installed honk on your server and are familiar with the /memes/ sub-directory of the -datadir containing the honk database.

For each user requiring a pedestrian, image avatar, do the following:

The Code

For others: You will not need this.

Kano, there are about 10 lines to change in a single file in the top level directory avatar.go.

$ diff -u avatar.go.orig avatar.go
--- avatar.go.orig  2022-11-14 11:06:53.931292710 +0000
+++ avatar.go 2022-11-14 12:29:02.654340774 +0000
@@ -23,6 +23,8 @@
+ "os"
+ "path/filepath"
@@ -66,6 +68,13 @@

 func genAvatar(name string, hex bool) []byte {
+ avafname := fmt.Sprintf("%s/memes/%s.jpg", dataDir, filepath.Base(name))
+ if buf, err := os.ReadFile(avafname); err == nil {
+   return buf
+ } else {
+   ilog.Printf("genAvatar cannot find %q, using better default\n", avafname)
+ }
  h := sha512.New()
  s := h.Sum(nil)
Building, as you will know, having installed the server already, is accomplished by a simple make in the top level directory.

site built using mf technology