Thread Tools Display Modes
09-28-09, 05:33 PM   #1
Landrell
A Chromatic Dragonspawn
 
Landrell's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 171
Arrow KgPanels Border Class Color Help

Alright, I'm a bit of a new when it comes to coding, but let me explain what I'm aiming for.

I currently have my UI set up using both a standard texture like HAL and a Border texture which is a slightly modified HalBorder. When I use this script:

Code:
local _, class = UnitClass("player");
	if class == "WARRIOR" then
        self.bg:SetVertexColor(0.95, 0.23, 0.23, self.bg:GetAlpha())
	elseif class == "PRIEST" then
        self.bg:SetVertexColor(1, 0.96, 0.98, self.bg:GetAlpha())
	elseif class == "MAGE" then
        self.bg:SetVertexColor(0.00, 1, 1, self.bg:GetAlpha())
	elseif class == "DRUID" then
        self.bg:SetVertexColor(1, 0.49, 0.04, self.bg:GetAlpha())
	elseif class == "PALADIN" then
        self.bg:SetVertexColor(0.92, 0.22, 0.46, self.bg:GetAlpha())
	elseif class == "HUNTER" then
        self.bg:SetVertexColor(0.33, 0.86, 0.00, self.bg:GetAlpha())
	elseif class == "ROGUE" then
        self.bg:SetVertexColor(1, 0.94, 0.16, self.bg:GetAlpha())
	elseif class == "SHAMAN" then
        self.bg:SetVertexColor(0.13, 0.42, 1, self.bg:GetAlpha())
	elseif class == "WARLOCK" then
        self.bg:SetVertexColor(0.36, 0.18, 1, self.bg:GetAlpha())
	end
What happens is that the textured background gets colored by the class I'm currently on. What I'm trying to do or figure out is what part of the script here do I need to change and to what in order for the BORDER to get changed to the class color instead? I'm hoping I can use this piece of existing code to do this.

Any help or suggestions would greatly be appreciated.
__________________

Fear my Aim, for it be True, Swfit, and Deadly!
  Reply With Quote
09-28-09, 07:25 PM   #2
Yhor
A Pyroguard Emberseer
 
Yhor's Avatar
Join Date: May 2007
Posts: 1,077
I think you've only shown the code for how coloring is handled, not what gets colored. If that code is working for your background, you should be able to use it for your borders by inserting it in similar fashion to your background. If you have any troubles, show your background and border code as they are so you can get some better help.

I'm not very familiar with KGpanels, so if someone else offers advice, you'll probably be safer listening to them... it just looks incomplete to me.
  Reply With Quote
09-28-09, 07:55 PM   #3
Landrell
A Chromatic Dragonspawn
 
Landrell's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 171
Yeah, what this particular piece of script does is that you insert it in the KgPanels active panels On Load table. And once you do that and reload the UI, it will color the Background texture, but not the border. And since these are two different components but under the same panel, I was wondering if there was any way to edit this particular piece of script to handle the border, but not the background texture itself.

But if that isn't the case, then I guess I'll have to make separate layout (shudders) for each class and manually color them. And then tie in each profile to the particular layout that should go with the toon. That's the one thing I'm desperately trying to avoid.

I'm honestly not that handy with coding in general, and I have looked all over the internet including the WoWAce forums about this particular piece of script. But I haven't been lucky yet. But thank you, Yhor for the input nonetheless!
__________________

Fear my Aim, for it be True, Swfit, and Deadly!
  Reply With Quote
09-28-09, 09:38 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
You want to use self:SetBackdropBorderColor(r,g,b)

Also, just so you know, that long if statement is only good if you want to use custom colors for classes. If you want to make sure they're the game's default colors, then you'll need to look them up in the RAID_CLASS_COLORS table. Of, if you use an addon like ClassColors, then that table instead.

Code:
local _,class = UnitClass("player")

self:SetBackdropBorderColor(RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b)
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-28-09, 09:45 PM   #5
Yhor
A Pyroguard Emberseer
 
Yhor's Avatar
Join Date: May 2007
Posts: 1,077
Originally Posted by Seerah View Post
You want to use self:SetBackdropBorderColor(r,g,b)

Also, just so you know, that long if statement is only good if you want to use custom colors for classes. If you want to make sure they're the game's default colors, then you'll need to look them up in the RAID_CLASS_COLORS table. Of, if you use an addon like ClassColors, then that table instead.
Thanks Seerah, I probably would've searched another hour or two to find something, or give up.

To add to what Seerah points out, her way would also include Deathknights (but who really wants DK colors, anyway ).
  Reply With Quote
09-28-09, 10:59 PM   #6
Landrell
A Chromatic Dragonspawn
 
Landrell's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 171
Thank you so much Seerah and Yhor! That should work as intended.
__________________

Fear my Aim, for it be True, Swfit, and Deadly!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » KgPanels Border Class Color Help


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off