Find a bug? Do not post it in the comments section! See the "Reporting Problems" section below for information on how to correctly report bugs. I will no longer be responding to bugs posted in the comments section.
Description
Class Colors lets you change class colors without breaking the Blizzard UI.
Please post specific bug reports and feature requests in the ticket tracker using the links to the right (just below the big Download link).
General questions, comments, suggestions, and other feedback may be posted in the comments section on this page, or in the the discussion thread on wowace.com.
How can changing class colors break the Blizzard UI?
Addons like the ubiquitous !ReTeal change colors by changing the values in a table called RAID_CLASS_COLORS, which is created by Blizzard code. Doing so causes all other Blizzard code which reads from this table to become "tainted", and Blizzard's secure code restrictions mean that parts of the UI whose code is tainted stop working. Tainting the RAID_CLASS_COLORS table means that you can't see the raid panel while you're in combat, and can't set main tanks or main assists from the right-click menu in the raid panel.
How does Class Colors solve this problem?
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.
Frequently Asked Questions
Why don't my color changes show up in <insert addon name>?
There are three reasons why an addon might immediately not reflect the changes you make through Class Colors.
1) The addon might not support Class Colors at all. If this is the case, ask the author to add support. Supporting Class Colors requires only adding a few lines of code, so if you ask politely and include a link to this page so the author doesn't have to hunt for information, most authors are willing to do it.
2) If the addon has its own options to change the class colors it uses, you might need to reset its color options. Look for an option to reset class colors. Grid and Recount both fall into this category.
3) The addon might not listen for the announcements Class Colors can provide when a color has changed. If this is the case, you will need to reload your UI before it will use the new colors. You can also point the author at this page and ask them to add callback support.
Information 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. There are two ways you can account for this possibility.
1) 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.
2) You can just add !ClassColors to your addon's OptionalDeps field, though this is not a recommended solution, as it will prohibit other implementations of CUSTOM_CLASS_COLORS and clutter up your TOC.
API documentation and information on alternative implementations can be found on my WoWInterface portal.
what the current version of WoW in your region is.
Most importantly, remember to check on your ticket after a few days, as I may need more information to solve the problem!
License
Please see my portal or the README file included in the addon's folder for the full license terms under which this addon is released. In particular, redistribution without prior permission is prohibited. Compilation creators, please show your support for addon authors by taking a few minutes to learn about the basic details of copyright law and software licensing before you upload. Thanks!
Note that I will almost certainly give you permission to include Class Colors in your compilation. Earlier versions were released under terms that did not require permission, but due to the actions of certain unscrupulous distributors, I have chosen to license it under stricter terms to thwart their efforts to make money by essentially stealing my addon. If you are a regular compliation creator, just ask!
Change Log - Class Colors
3.2.0.16
Added support for default UI's coloring player names in chat by class
3.1.2.14
Added checks for cases where UnitClass fails to return values
3.1.2.13
Fixed nil value error in coloring for arena team list
3.1.2.12
Forgot to turn off debugging for the last release
3.1.2.11
Add coloring for friends list (online friends only)
Add coloring for arena team list (untested)
Add coloring for trade frame (player names)
Add coloring for inspect frame (player name)
Add coloring for unit frames (player names only)
3.1.1.8a
Update license terms (see README)
3.1.0.8-beta
Fix LFG frame coloring for WoW 3.1
3.0.9.5-beta
Fix deDE translation for "Death Knight"
Increase size allotted to description text in config panel to prevent truncation
3.0.9.4-beta
Fix callbacks for handler[method] functions.
3.0.9.3-beta
Fix metatable
Add reset button to config panel
Change config panel to apply color changes immediately instead of waiting until the panel is closed
3.0.9.2-beta
Remove :IterateClasses method
Move :RegisterCallback and :UnregisterCallbacks to metatable __index
Originally posted by Phanx Replied to your bug report. Also, if you're expecting someone to change something for your sake, beginning your request with an insult is probably not the best approach.
I'm sorry, I wasn't aware it is seen that rude. English is not my first language.
Replied to your bug report. Also, if you're expecting someone to change something for your sake, beginning your request with an insult is probably not the best approach.
The implementation of the unit frame coloring is a bit poor, don't you think? By using SetTextColor() and only executing that bit of code when the unit is a player, you change the color to a class color permanently, resulting in random class colors if you target an NPC, depending on the class of your last player target.
Please test with all other addons disabled; I see Factionizer at least mentioned in the error's stack trace, and Blizzard code shouldn't be calling the relevant function without parameters. If the error persists, post a bug report using the Bug Report button underneath the Download button. Otherwise, track down which addon is causing the problem by enabling addons until the problem comes back, and ask its author to fix it.
Add coloring for friends list (online friends only)
Add coloring for arena team list (untested)
Add coloring for trade frame (player names)
Add coloring for inspect frame (player name)
Add coloring for unit frames (player names only)
Went ahead and finished up some extra goodies I've been working on. Note that arena team list coloring is untested, since I'm not on any arena teams. Please report any issues with it.
This change was made primarily to prevent WoWMatrix from distributing my addon. If you are a compilation uploader whose compilation currently includes !ClassColors, please send an email "addons AT phanx DOT net" with the URL(s) where your compilation is available for permission to continue distributing my addon.
Originally posted by Zergreth Edit: By the way, there's a locale error in the deDE table. The proper translation of death knight is Todesritter, not Todestritter.
Hah. I guess Babble has it wrong, then. Will fix soon.
Originally posted by Phanx You can no longer view the raid panel while in combat, and you can no longer set main tanks or main assists from the raid panel right-click menu, for example. This occurs because all of the raid panel code is "secure", and in order for it to remain secure, everything that touches it must also be secure. RAID_CLASS_COLORS comes from Blizzard code, and is thus secure by default, but if an addon touches it, it becomes tainted, and taints anything else that's secure that uses it.
Addons that modify the friends frame can cause the same kind of taint, because they touch the social window (which the raid panel is part of). Basically, that whole part of Blizzard's code is written rather poorly, and is extremely susceptible to taint from a multitude of greatly varied sources.
I suspect that modifying RAID_CLASS_COLORS may also have something to do with the "action blocked" errors people receive that name random addons as having attempted to call the protected function LFGQuery()... since I haven't been modifying RAID_CLASS_COLORS, I haven't seen a single occurrence, while previously they occurred quite regularly at a rate of several per hour.
Ah, quite interesting. Thanks for the information. Guess I will use Class Colors instead of ReTeal then (:
Edit: By the way, there's a locale error in the deDE table. The proper translation of death knight is Todesritter, not Todestritter.
Originally posted by Zergreth I would like to have some details here. What does it break, and why (if possible)?
You can no longer view the raid panel while in combat, and you can no longer set main tanks or main assists from the raid panel right-click menu, for example. This occurs because all of the raid panel code is "secure", and in order for it to remain secure, everything that touches it must also be secure. RAID_CLASS_COLORS comes from Blizzard code, and is thus secure by default, but if an addon touches it, it becomes tainted, and taints anything else that's secure that uses it.
Addons that modify the friends frame can cause the same kind of taint, because they touch the social window (which the raid panel is part of). Basically, that whole part of Blizzard's code is written rather poorly, and is extremely susceptible to taint from a multitude of greatly varied sources.
I suspect that modifying RAID_CLASS_COLORS may also have something to do with the "action blocked" errors people receive that name random addons as having attempted to call the protected function LFGQuery()... since I haven't been modifying RAID_CLASS_COLORS, I haven't seen a single occurrence, while previously they occurred quite regularly at a rate of several per hour.
Originally posted by Seerah Yes, changing RAID_CLASS_COLORS taints the raid UI immensely. Which is precisely why this addon was developed (so that you're not doing that).
I would like to have some details here. What does it break, and why (if possible)?