View Single Post
06-18-05, 10:47 AM   #7
Beladona
A Molten Giant
 
Beladona's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 539
try forcing red to never reach a full color value of 1. This will make it so that when green is at half, red will be less than half. Your ugly color is occuring because green and red are both reaching 0.5 which turns out as a very muddy orange/brown...

Code:
-- first get your health percentage, basically current health / max health
-- the percentage should return as a decimal value between 1.0 and 0.0
-- once you have that percentage, call the next function with the percentage as the argument
SathPanel_GetColorFade(percent)
	local red = (1-percent) * 100;
	local color = {r = red/125; g = percent; b = 0;};
	return color;
end
Basically the highest red will ever reach is 0.8, which is a bright enough red for when you reach little to no health. Green will be offset from red, effectively eliminating that muddy color you saw...
  Reply With Quote