czplugins
nickcolors
author: John J Foerch
A plugin to automatically colorize nicknames in chat views. A work in progress. The technique is to create an empty stylesheet object whose href is "data:" and to fill that stylesheet with coloring rules for each known nickname. There are a number of difficulties to overcome to make this plugin work, but I am convinced it can be done. When I complete this plugin, I will use the same technique in a rewrite of my avatars plugin.
Internally, the plugin has an array called palette that contains the css colors from which to choose. The choice of color is generated from the nickname, with a technique called hashing. I have designed this plugin with the intention that people will be able to customize both the palette and the hashing algorithm.
The present state of the plugin is that it works to a limited degree. It will colorize all the nicknames known to ChatZilla at the time the plugin is loaded. That means you can't yet load it at startup. And it does not watch for nickname changes, join events, and the creation of new views.
My present challenge in this project is to devise a memory-efficient way to maintain the dynamic stylesheets. There is one stylesheet for each chat view. Each sheet should contain only those rules which are relevant to the nicknames that appear in that view. If you have an idea of how to accomplish this, please write and share.
cvs -d :pserver:guest@mozdev.org:/cvs login
#password is guest
cvs -d :pserver:guest@mozdev.org:/cvs checkout -d nickcolors czplugins/src/appearance/nickcolors
tip: for an easy install, cvs-checkout this plugin directly into the scripts directory of your Chatzilla profile.