Colorize User NickNames in the middle of IRC messages ( colorize.pl XChat Plugin)

technology.pngI’ve been using XChat2 for IRC for a while now (it’s free, it’s for Windows and *nix), and while looking for a solution to a different problem, I ran across the colorize perl script.  It colorizes a user’s nickname even if it’s in the middle of a message.

Unfortunately, the original webpage (which the link collections pointed toward) was offline.  I managed to dig up a copy from The Wayback Machine, and have it now as a gist on GitHub for anyone who might need it.

I did not author this script, nor I have I altered the script, I’m just keeping the useful script available to the public under the GPL license;  the documentation is below.

NAME

colorize.pl – Colorize messages and/or embedded nicks with corresponding colors.

VERSION

This documentation refers to colorize.pl version 0.0.3.

INSTALLATION

Short answer:

Put this file in your Xchat data directory (e.g. ~/.xchat2 on linux). Make sure you’ve turned on colored nick names in your preferences.

Long answer:

The following is from https://www.xchat.org/faq/#q218

  1. How do I auto-load scripts at startup?

    You just have to place the scripts into XChat’s data directory. XChat will auto-load scripts if they have the right extension .e.g If a filename ends in .pl, it will be loaded as a Perl script. This data directory is different on each platform:

    Windows

    It depends on your version of Windows and where it stores the Application Data folder. On Windows XP it is usually:

    C:Documents and SettingsusernameApplication DataX-Chat 2

    UNIX

    ~/.xchat2/ Where "~" represents your home directory i.e.: $HOME/.xchat2/

    USAGE

    /colorize [OPTION]

    If no option is given, the default action is to show the current settings.

      ?, help – Display this help message

    Enable/Disabling Colorization

      enable – Enable colorizing
      disable – Disable colorizing

    Colorizing Schemes

      all – Colorize message and embedded nicks in message
      message – Colorize message only
      nicks – Colorize embedded nicks only

    Example. To set colorization scheme to only colorize embedded nicks:

    /colorize nicks

    Note that you only need to type the first letter of the option. So the following command will also set the scheme to colorize just nicks:

    /colorize n

    CONFIGURATION

    You can customize the type and color of the brackets that surround the nick names. The default is to not have any surrounding brackets.

    To change the bracket type and color, go to the section labeled "BRACKET SETTINGS" towards the top of the script and edit the three variables:

     my $BRACKET_COLOR       = "";
     my $LEFT_BRACKET_STYLE  = ”;
     my $RIGHT_BRACKET_STYLE = ”;

    You can use the %color hash defined at the top of the script for defining  $BRACKET_COLOR. For example, to set the bracket color to green, set the following:

     my $BRACKET_COLOR = $color{green};

    The brackets can be any characters you want, you are not limited to  the usual ‘<‘ and ‘>’. For example, to set the bracket type to use parentheses, set the following:

     my $LEFT_BRACKET_STYLE  = ‘(‘;
     my $RIGHT_BRACKET_STYLE = ‘)’;

    INCOMPATIBILITIES

    Xchat 2.0.8 or above is required to load this plugin.

    BUGS AND LIMITATIONS

    Please report any bugs you find to the author.  [EDIT: NOT STEVEN SAUS]

    This version only colorizes messages sent by other users. It does not colorize messages sent by you or for you.

    Patches welcome. 🙂

    SEE ALSO

    https://web.archive.org/web/20051231070238/https://ant.home.comcast.net/colorize/ is where this plugin is hosted.
    [EDIT:  Now at https://gist.github.com/uriel1998/5026598]

    https://www.xchat.org/docs/xchat2-perl.html has good documentation on writing perl plugins.

    AUTHOR

    jf3 at swift.fastmail.fm

    LICENSE AND COPYRIGHT

    This plugin is made available under the same license as XChat, which is the GPL. You can read it at https://www.gnu.org/licenses/gpl.txt.