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
Version 3.3.0.26
Added coloring of class names in the channel pane of the chat config window
Version 3.3.0.24
Added coloring of names in the LookingForRaid interface
Fixed drycode errors
Version 3.3.0.22
Updated for WoW 3.3
Removed coloring for parts of the UI that aren't normally colored. This functionality may or may not reappear in a separate addon at a later date.
Version 3.2.0.16
Added support for default UI's coloring player names in chat by class
Version 3.1.2.14
Added checks for cases where UnitClass fails to return values
Version 3.1.2.13
Fixed nil value error in coloring for arena team list
Version 3.1.2.12
Forgot to turn off debugging for the last release
Version 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)
Version 3.1.1.8a
Update license terms (see README)
Version 3.1.0.8-beta
Fix LFG frame coloring for WoW 3.1
Version 3.0.9.5-beta
Fix deDE translation for "Death Knight"
Increase size allotted to description text in config panel to prevent truncation
Version 3.0.9.4-beta
Fix callbacks for handler[method] functions.
Version 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
Version 3.0.9.2-beta
Remove :IterateClasses method
Move :RegisterCallback and :UnregisterCallbacks to metatable __index
No. As I've said previously, !ClassColors is about changing player class colors; functionality to change other colors falls outside of the scope, and will never be added. Other colors, such as power bar colors, and reaction colors (what are used for NPC unit colors) can be changed by overriding values in the default tables created and used by Blizzard code, as altering these tables does not taint any secure code paths. If you want to change them, simply do what you're already doing -- add your overrides to any addon's Lua file, or create a separate personal addon and stick the overrides in there.
No errors, worked fine. I updated to latest. Any chance you can add a color picker for mana? For now, I added this code at the bottom of classcolors.lua to tweak the color and it's working:
Also, is there a way to change the bar color for pets and NPCs? I have a warlock and my Felguard shows as a green health bar, but not sure technically which class he aligns to. Most NPCs show as a green bar too. Do you know what code would be needed to adjust that color (perhaps similar to above)?
You're several versions out of date, then, and your copy should be generating tons of errors in WoW 3.3. That commented stuff was just left over from before the addon was developed for public release, and wasn't intended to stick around as long as it did. I do change the mana bar color in my UI, but not from !ClassColors, nor is that something !ClassColors will ever (intentionally) do.
Hi Phanx. Noticed a commented area at the bottom of classcolors.lua. I uncommented it out and it gave me a much softer blue for the mana bar, whicih I liked from !Lyncolors. I assume you left it there so we could uncomment it and use? Seems like a much better default color than the standard darker blue mana color.
It appears 3.3 hasn't quite broken it, just made a lua error regarding LFMFrame_Update not existing appear on every reload/login.
Commenting out lines 244-266 of ClassColorsBlizz.lua "fixes" it.
Code:
--[[ hooksecurefunc("LFMFrame_Update", function()
-- print("LFMFrame_Update")
local button, class, color, _
local n = GetNumLFGResultsProxy()
local offset = FauxScrollFrame_GetOffset(LFMListScrollFrame)
for i = 1, LFGS_TO_DISPLAY do
if offset <= n then
button = _G["LFMFrameButton"..i]
if button:IsShown() then
name, _, _, _, _, _, _, _, _, _, class = GetLFGResultsProxy(offset + i)
if class then
color = CUSTOM_CLASS_COLORS[class]
if color then
_G["LFMFrameButton"..i.."Class"]:SetTextColor(color.r, color.g, color.b)
end
end
end
end
end
end)
--]]
__________________
-- Elphie --
[Matanya of Arthas]
Originally posted by questionn can i active this addon for the default ui bar ?
i need the healthbar colored by class
The purpose of this addon is to change class colors. Applying class colors to parts of the UI that are not colored by default, and whose function may be significantly altered by such application, is outside the scope of this addon. It would be fairly simple for you (or a programmer friend) to write an addon to apply class coloring to the default health bars, but it isn't something I'll add to Class Colors.
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.