1. #1
    Deleted

    Ho to Set a KgPanel to Monk Class Color?

    Hi, I am trying to figure out how to set a KgPanel to change background color for all classes. I found one script but it does not work for monks and I do not know the class color in rgb 0-1 format for them. I found jade green on wow wiki but it does not look right. It is too dark and other addons seem to have a much brighter green then this such as most unit frames.

    Can anyone help me out?

  2. #2
    Deleted
    I use the following:
    Code:
    local classcolor = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[(select(2, UnitClass("player")))]
    and then use this for the background color:
    Code:
    self.bg:SetVertexColor(classcolor.r, classcolor.g, classcolor.b)

  3. #3
    Deleted
    Thank you so much! Worked perfectly. Still it would have been nice to know the RGB 0-1 number for Monks but that shouldn't be a problem anymore. ty again.

    ---------- Post added 2012-09-26 at 03:10 PM ----------

    I have another problem. I want the script to run OnUpdate and it works. When I select a class, the class colour shows but then when I leave my target frame (which is what I want the class colour to apply for), I get this error:

    Message: [string "bgtar_OnUpdate"]:13: attempt to index local 'classcolor' (a nil value)

    What should I do?

    ---------- Post added 2012-09-26 at 03:25 PM ----------

    It works for some of the frames but not for OnUpdate. Can I just use my normal code:
    Code:
    local _, class = UnitClass("player");
    	if class == "WARRIOR" then
    		self.text:SetTextColor(0.78, 0.61, 0.43)
    	elseif class == "PRIEST" then
    		self.text:SetTextColor(1.00, 1.00, 1.00)
    	elseif class == "MAGE" then
    		self.text:SetTextColor(0.41, 0.80, 0.94)
    	elseif class == "DRUID" then
    		self.text:SetTextColor(1.00, 0.49, 0.04)
    	elseif class == "PALADIN" then
    		self.text:SetTextColor(0.96, 0.55, 0.73)
    	elseif class == "HUNTER" then
    		self.text:SetTextColor(0.67, 0.83, 0.45)
    	elseif class == "ROGUE" then
    		self.text:SetTextColor(1.00, 0.96, 0.41)
    	elseif class == "SHAMAN" then
    		self.text:SetTextColor(0.0, 0.44, 0.87)
    	elseif class == "WARLOCK" then
    		self.text:SetTextColor(0.58, 0.51, 0.79)
    	elseif class == "DEATHKNIGHT" then
    		self.text:SetTextColor(0.77, 0.12, 0.23)
    	elseif class == "MONK" then
    		self.text:SetTextColor(0.33, 0.54, 0.52)
    end
    But just someone tell me what the MONK RGB 0-1 is? The one in the code above is wrong, that is from wow wiki and is not the right color. Thank you!
    Last edited by mmocfcfb20ed0e; 2012-09-26 at 02:25 PM.

  4. #4
    Deleted
    The RGB format is 0, 250, 150so by dividing them all by 255 you get:

    0, 1, 0.58823...

    so use this:

    Code:
    elseif class == "MONK" then
    		self.text:SetTextColor(0, 1, 0.59)
    end

  5. #5
    Deleted
    thank you once again Pharrax! Works much better now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •