Thread Tools Display Modes
04-16-10, 04:06 AM   #1
Kreka
A Defias Bandit
Join Date: Sep 2009
Posts: 2
Class coloured text and background

Hi I've never really tried messing around with lua code before but thought I'd give oUF a try, just two quick questions. How do I set name text to be coloured by class and I would like the Health background to be class coloured too but the health to be a dark grey/black.

I've looked through codes and found how to set it as a specific colour

Frame:SetBackdropColor(red, green, blue [, alpha])

but this will only set it to one colour.

any help appreciated.
  Reply With Quote
04-16-10, 08:01 AM   #2
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Take a look at oUF\elements\health.lua and tags.lua.

If you use tags for your "text" you can use [raidcolor] to color a tag by class,
like "[raidcolor] [hptag]" or "[raidcolor] [nametag]".

I haven't tried to use health.bg.colorClass = true, but it should work in theory. You might have to play around with it a little though,
like health.bg1.colorClass = true

The number (1) can be anything, it's just there to prevent the background from inheriting it's color from health's color (which would do it by default).
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
04-16-10, 08:30 AM   #3
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by Dawn View Post
I haven't tried to use health.bg.colorClass = true, but it should work in theory. You might have to play around with it a little though,
like health.bg1.colorClass = true
Health.bg just inherits the color from Health with a multiplier applied. That's really all there is to it. More advance handling require manual interaction.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
04-16-10, 01:15 PM   #4
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Which means "health.bg1.colorClass = true" wouldn't work just that easy? Just curious.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
04-16-10, 01:32 PM   #5
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Nope. Unless an element is explicitly handled by the oUF core or a plugin then you need to do it yourself - bg1 isn't a handled element. For that matter bg has no other attributes besides multiplier, so .colorClass wouldn't even work on that.

As haste said, the bg element inherits the color from the parent element itself if you're using a colorX flag.
  Reply With Quote
04-16-10, 08:19 PM   #6
Mokane
A Deviate Faerie Dragon
 
Mokane's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 16
Originally Posted by Kreka View Post
Hi I've never really tried messing around with lua code before but thought I'd give oUF a try, just two quick questions. How do I set name text to be coloured by class and I would like the Health background to be class coloured too but the health to be a dark grey/black.

I've looked through codes and found how to set it as a specific colour

Frame:SetBackdropColor(red, green, blue [, alpha])

but this will only set it to one colour.

any help appreciated.
If you take a look at what Zork does in his D3Orbs layout. He uses PostUpdateHealth to set the bar.bg texture that way. He has it set to go out and get the class color from the RAID_CLASS_COLORS table. You could do that and it would work for what you want.
  Reply With Quote
04-17-10, 04:51 AM   #7
Kreka
A Defias Bandit
Join Date: Sep 2009
Posts: 2
If you take a look at what Zork does in his D3Orbs layout. He uses PostUpdateHealth to set the bar.bg texture that way. He has it set to go out and get the class color from the RAID_CLASS_COLORS table. You could do that and it would work for what you want.
Thanks I'll give it a try.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Class coloured text and background


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