emacs-circe / circe

Circe, a Client for IRC in Emacs
GNU General Public License v3.0
390 stars 51 forks source link

Allow nicks to be colored based on their hash #397

Open jensecj opened 3 years ago

jensecj commented 3 years ago

Adds a new variable circe-color-nicks-persist which causes nicknames to be colored by using their hash as an index into circe-nick-color-pool.

There are a couple of minor foibles:

Changing the signature of circe-nick-color-pick breaks backwards-compatability, I have looked around and not found anyone who actually used this anywhere, so I don't think it's a major problem, could be solved by making the new argument optional.

Changing circe-color-nicks-persist after some nicks have been popped from the pool reduces the available colors, but I don't imagine people flip-flopping the setting often.

wasamasa commented 3 years ago

I'd use a separate pool for fixed colors. That way it won't be depleted.

The hashing approach seems a tad clownshoes. Is it adapted from an existing solution? If not, I'd reuse something from Weechat: https://github.com/weechat/weechat/blob/master/src/gui/gui-nick.c

Might also make the code clearer to have a customizable hash function.