Thread Tools Display Modes
11-01-09, 03:07 AM   #1
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
Couloring

I'd like to go back to colored health bars, but can't rember how i did it the last time

Changed:
Code:
r, g, b = self.ColorGradient(min/max, 1,0.29,0.24, 1,0.97,0.33, 0.2,1,0.35)
To: (just a more uptodate way to do this I think)
Code:
r, g, b = oUF.ColorGradient(min/max, unpack(oUF.colors.smooth))

Code:
local function PostUpdateHealth(self, event, unit, bar, min, max)
	if(max ~= 0) then
--		r, g, b = self.ColorGradient(min/max, 1,0.29,0.24, 1,0.97,0.33, 0.2,1,0.35)
		r, g, b = oUF.ColorGradient(min/max, unpack(oUF.colors.smooth))
	end

    if(UnitIsDead(unit)) then 
        bar.value:SetText('Dead') 
    elseif(UnitIsGhost(unit)) then 
        bar.value:SetText('Ghost') 
    elseif(not UnitIsConnected(unit)) then 
        bar:SetValue(0) 
        bar.value:SetText('Offline') 
    else 
		if(min~=max) then
			if(unit=='player' or unit=='pet') then 
				bar.value:SetFormattedText('%d (|cff%02x%02x%02x%d|r%%)', (min), r*255, g*255, b*255, (min/max)*100)
			elseif(unit=='target' or unit=='focus') then 
				bar.value:SetFormattedText('%s (|cff%02x%02x%02x%.1f|r%%)', letter(min), r*255, g*255, b*255, (min/max)*100)
			elseif(self:GetParent():GetName():match'oUF_Raid') then
				bar.value:SetFormattedText('|cffff8080%s|r', rletter(min-max))
			else
				bar.value:SetFormattedText('|cffff8080%s|r', letter(min-max))
			end
		else
			if(unit=='player' or unit=='pet') then  
				bar.value:SetFormattedText('%s', (max))
			elseif(unit=='target' or unit=='focus') then 
				bar.value:SetFormattedText('%s', letter(max))
			else
				bar.value:SetText('')
			end
		end
	end
	
	if(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) and not UnitIsPlayer(unit)) then 
        color = {0.7,0.7,0.7}
            bar:SetStatusBarColor(color[1], color[2], color[3]) 
    else 
	bar:SetStatusBarColor(r*255, g*255, b*255)
--	bar:SetStatusBarColor(.22,.22,.22) 
    end 

	self:UNIT_NAME_UPDATE(event, unit)
end
Changed:
Code:
bar:SetStatusBarColor(.22,.22,.22)
to:
Code:
bar:SetStatusBarColor(r*255, g*255, b*255)
But I must be missing something here.

One mor thing, for some odd reason y runepowers won't show the color they need (show up white) . until I used them or do a /rl

thanks
  Reply With Quote
11-01-09, 10:22 AM   #2
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
The build in runes don't like loading rune colors until you /rl. That has been talked about in "oUF - General discussion" (I believe it was there...). Not sure if there is a workaround for it yet, haven't looked into it when it was talked about. At least it still happens for me, too. And I added runes just yesterday.

Edit: I just looked it up again and it was talked about over here.

Last edited by Dawn : 11-01-09 at 10:28 AM.
  Reply With Quote
11-02-09, 12:19 AM   #3
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
Thanks,

Do you know who i would get the health bars colored like I have colored the %health.
  Reply With Quote
11-02-09, 06:21 AM   #4
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,711
Code:
self.Health.colorHealth = true
  Reply With Quote
11-02-09, 09:15 AM   #5
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
Hey thanks that sure is easier that what I did.

would it still show tapped / disc / dead people with a difrent color
  Reply With Quote
11-02-09, 09:55 PM   #6
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,711
Originally Posted by Quokka View Post
Hey thanks that sure is easier that what I did.

would it still show tapped / disc / dead people with a difrent color
Yes, colors has a priority.
See oUF/health.lua for more info.
  Reply With Quote
11-08-09, 03:44 PM   #7
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
for some reason the colors look good, except disc. and tapped don't show up

Code:
local function PostUpdateHealth(self, event, unit, bar, min, max)

    if(UnitIsDead(unit)) then 
        bar.value:SetText('Dead') 
    elseif(UnitIsGhost(unit)) then 
        bar.value:SetText('Ghost') 
    elseif(not UnitIsConnected(unit)) then 
        bar:SetValue(0) 
        bar.value:SetText('Offline') 
    else 
		if(min~=max) then
		local r, g, b
		r, g, b = oUF.ColorGradient(min/max, unpack(oUF.colors.smooth))
			if(unit=='player' or unit=='pet') then 
				bar.value:SetFormattedText('%d (|cff%02x%02x%02x%d|r%%)', (min), r*255, g*255, b*255, (min/max)*100)
			elseif(unit=='target' or unit=='focus') then 
				bar.value:SetFormattedText('%s (|cff%02x%02x%02x%.1f|r%%)', letter(min), r*255, g*255, b*255, (min/max)*100)
			elseif(self:GetParent():GetName():match'oUF_Raid') then
				bar.value:SetFormattedText('|cffff8080%s|r', rletter(min-max))
			else
				bar.value:SetFormattedText('|cffff8080%s|r', letter(min-max))
			end
		else
			if(unit=='player' or unit=='pet') then  
				bar.value:SetFormattedText('%s', (max))
			elseif(unit=='target' or unit=='focus') then 
				bar.value:SetFormattedText('%s', letter(max))
			else
				bar.value:SetText('')
			end
		end
	end
	
	if(UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) and not UnitIsPlayer(unit)) then 
        color = {0.7,0.7,0.7}
    else 
		local r, g, b = oUF.ColorGradient(min/max, unpack(oUF.colors.smooth))
		bar:SetStatusBarColor(r, g, b)
    end 
	
	self:UNIT_NAME_UPDATE(event, unit)
end
anyone that could help me
  Reply With Quote
11-08-09, 05:05 PM   #8
Rostok
A Flamescale Wyrmkin
Join Date: Jul 2008
Posts: 127
When a unit is disconnected, your bar is empty so you should see your bar bg, adjust your bg or don't put SetValue(0) in your function for this pb.
With your Tapped one, what is "color" ?
Nothing, just replace "color = ..." with bar:SetStatusBarColor(0.7,0.7,0.7).
  Reply With Quote
11-08-09, 05:09 PM   #9
Quokka
A Chromatic Dragonspawn
 
Quokka's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 196
Originally Posted by Rostok View Post
When a unit is disconnected, your bar is empty so you should see your bar bg, adjust your bg or don't put SetValue(0) in your function for this pb.
With your Tapped one, what is "color" ?
Nothing, just replace "color = ..." with bar:SetStatusBarColor(0.7,0.7,0.7).
thx m8, mised that
  Reply With Quote
11-08-09, 06:27 PM   #10
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,711
Code:
self.Health.colorDisconnected = true
self.Health.colorTapped = true
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Couloring


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