Quantcast
WoWInterface - View Single Post - KGpanels class colors.
View Single Post
06-24-12, 11:39 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You can do the same thing in a lot less code by getting the value from the class colors table instead of hard-coding in a bunch of checks and values for every class:
Lua Code:
  1. local _, class = UnitClass("player")
  2. local color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
  3. self.bg:SetVertexColor(color.r, color.g, color.b, self.bg:GetAlpha())
This also has the advantage of supporting custom class colors.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Donít message me about addon bugs or programming questions.
  Reply With Quote