• World of Warcraft Addons
  • World of Warcraft
  • Average Rating:

  • Your Rating

  • Share
  • Report Abuse

Class Colors

 

Project Updated:
Files Updated: 08-07-2009
Supports Game Version: 3.2.0
Category: Miscellaneous
Tags:

[Edit Tags]

Project Manager: Phanx
Additional Authors: No additional authors
Current Version: 3.2.0.16
License: Do Not Redistribute
Development Site: CurseForge
Avg Daily DL (last 30 days): 16
Downloads Total: 4,961
Favorites: 11
Comments: 0
  • About Class Colors
  •  

Description

Class Colors allows you to change class colors without breaking the Blizzard UI.

Please use the ticket tracker to report specific bugs or request specific additions/changes. General comments, questions, and suggestions should be posted in the forum thread.

The Problem

Addons like !ReTeal change the RAID_CLASS_COLORS table, which is originally created by Blizzard code. Doing so causes all other Blizzard code which reads from RAID_CLASS_COLORS to become "tainted", and Blizzard's restrictions on "secure" code cause certain parts of the UI to stop working. Some examples of problems caused by tainting RAID_CLASS_COLORS include being unable to view the raid panel while in combat, and being unable to set main tanks and main assists from the right-click menu in the raid panel.

The Solution

Class Colors solves this problem by not touching RAID_CLASS_COLORS at all. Instead, it creates its own separate table called CUSTOM_CLASS_COLORS. Since this table isn't created by Blizzard code, and isn't used by any Blizzard code, it doesn't taint anything, and its values can be changed as much as you like. However, this does mean that any addons that read colors from RAID_CLASS_COLORS must be updated to read from CUSTOM_CLASS_COLORS instead (if it exists).

In addition to solving the taint problem, Class Colors also provides an in-game UI for changing class colors. It also applies your custom colors to the Blizzard UI in a safe way that doesn't taint it. To access the configuration UI, type "/classcolors" or open the Blizzard Interface Options window, select the AddOns tab, and select the "Class Colors" entry in the left-hand column.

For Addon Authors

Supporting this system is as easy as checking for the existence of a global table CUSTOM_CLASS_COLORS and reading from it instead of RAID_CLASS_COLORS if it exists.

If your addon creates a local cache of class colors, it is recommended that you also register for a callback when class colors are changed by the user (see API documentation below) and update your color cache when the callback is fired.

As not all users are on systems which load addon folders in alphabetical order, there is no guarantee that !ClassColors will be loaded before your addon naturally. There are two ways you can account for this possibility.

  • Ideally, you should delay using any class colors until the PLAYER_LOGIN event; if this is not possible, you could just build your cache from RAID_CLASS_COLORS if CUSTOM_CLASS_COLORS is not yet available when your addon loads, and then update your cache and register for callbacks on PLAYER_LOGIN.
  • Alternatively, you can add !ClassColors to your addon's OptionalDependencies, though this is not the recommended solution, as it will prohibit other implementations of CUSTOM_CLASS_COLORS and clutter up your TOC.

API Documentation

The following methods are defined on the CUSTOM_CLASS_COLORS table. They are defined using a metatable __index, so pairs() can still be used to iterate over CUSTOM_CLASS_COLORS without requiring extra code to filter out function values.

:RegisterCallback(method[, handler])

  • method - function or string
  • handler - table containing function value 'method' (required if 'method' is a string, ignored if 'method' is a function)
  • Registers a function to be called when class colors are changed.
  • If method is a function, that function will be called with no arguments.
  • If method is a string, handler is a table, and handler[method] is a function, handler[method] will be called with handler as the first argument.
  • If the function is already registered, nothing will happen.

:UnregisterCallback(method[, handler])

  • method - function or string
  • handler - table containing function value 'method' (required if 'method' is a string, ignored if 'method' is a function)
  • Removes a function from the callback registry.
  • If the function is not registered, nothing will happen.

Implementation Details

Class Colors is built on a proposed community standard for a global table of alternate class colors that can be freely modified without tainting anything. This means that addons must explicitly support this standard (see below for details). Class Colors is only one possible implementation of this standard. Any implementation must provide the following:

  • Create and populate a global table CUSTOM_CLASS_COLORS with the same keys and value structure as RAID_CLASS_COLORS
  • Define methods :RegisterCallback, and :UnregisterCallback on the CUSTOM_CLASS_COLORS table (see API documentation above), using a metatable __index so that people can still iterate over the table using pairs() without having to work around function values

The following are highly recommended, and generally expected, but won't technically break anything if they aren't provided:

  • Provide a facility by which users may change class colors
  • Store changed class colors between sessions
  • Maintain a registry of functions requesting callbacks when class colors are changed, and call those functions when appropriate (see API documentation above)
  • Apply user-defined class colors to the Blizzard UI
  • Downloads (4)
  •  
File Name Release Type Game Version Downloads Date
Addon Curse.com Beta 2.3.3 0 9/29/2008
  File Name Release Type Game Version Downloads Date  
  Class Colors 3.2.0.16 Release 3.2.0 2,330 8/7/2009
  Class Colors 3.1.2.14 Release 3.1.0 1,341 5/26/2009
  Class Colors 3.1.2.13 Release 3.1.0 194 5/25/2009
  Class Colors 3.1.2.12 Beta 3.1.0 249 5/24/2009
  • 1 page(s)
  • Screenshots (1)
  •  
  • Comments
This author has elected not to allow comments for this project.
  • Similar Addons
  •  

Average downloads per day

  1. 1,506 Skinner Miscellaneous
  2. 1,076 FuBar 3.6 Miscellaneous
  3. 626 Talented Miscellaneous
  4. 614 FuBar_MoneyFu Miscellaneous
  5. 496 Examiner Miscellaneous