You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ChimneySwift ee16f12cd0
Fix splitting
3 years ago
LICENSE Initial commit 3 years ago
README.md Update README.md 3 years ago
init.lua Fix splitting 3 years ago

README.md

Automatic Name Colorization

Automatically generates colors based off names and colorizes them in chat.

Idea

I know what you're thinking, "Jeeze, really, another color chat CSM? Seriously man? If all I wanted to do was dick around with chat I'd select from the numerous other options, what's so different about this?". I'm glad you asked, some people might prefer manually setting colors, but I always forgot, name_colorize generates colors based off the user's name and colorizes their name through out all chat automatically.

Features:

  • Colors stay the same for people with the same name (no matter what server)
  • Colorizes regular messages, status messages, /me and join and leave messages
  • Colorizes names mentioned in chat

Limitations:

  • Will completely block all regular chat messages from making their way to other CSM

The Algorithm

The color generation algorithm is subject to change (it's not particularly efficient), but does work for our purposes.

It's loosely based off the please.js JavaScript library, basically it generates a hash of the name, then a hue from the hash and then combines preset saturation and value parameters to construct an HSV. It then converts the HSV to RGB based on this gist, and then finally to hexadecimal based off the function used in the colour_chat CSM.

This method doesn't create a wide enough range of colors for my liking, but does a good enough job for release, if you have any suggestions please submit a PR.