PHP код:
function CompactUnitFrame_UpdateHealthColor(frame)
local r, g, b;
if ( not UnitIsConnected(frame.unit) ) then
--Color it gray
r, g, b = 0.5, 0.5, 0.5;
else
if ( frame.optionTable.healthBarColorOverride ) then
local healthBarColorOverride = frame.optionTable.healthBarColorOverride;
r, g, b = healthBarColorOverride.r, healthBarColorOverride.g, healthBarColorOverride.b;
else
--Try to color it by class.
local localizedClass, englishClass = UnitClass(frame.unit);
local classColor = RAID_CLASS_COLORS[englishClass];
--debug
--classColor = RAID_CLASS_COLORS["PRIEST"];
if ( (frame.optionTable.allowClassColorsForNPCs or UnitIsPlayer(frame.unit)) and classColor and frame.optionTable.useClassColors ) then
-- Use class colors for players if class color option is turned on
r, g, b = classColor.r, classColor.g, classColor.b;
elseif ( CompactUnitFrame_IsTapDenied(frame) ) then
-- Use grey if not a player and can't get tap on unit
r, g, b = 0.9, 0.9, 0.9;
elseif ( frame.optionTable.colorHealthBySelection ) then
-- Use color based on the type of unit (neutral, etc.)
if ( frame.optionTable.considerSelectionInCombatAsHostile and CompactUnitFrame_IsOnThreatListWithPlayer(frame.displayedUnit) ) then
r, g, b = 1.0, 0.0, 0.0;
elseif ( UnitIsPlayer(frame.displayedUnit) and UnitIsFriend("player", frame.displayedUnit) ) then
-- We don't want to use the selection color for friendly player nameplates because
-- it doesn't show player health clearly enough.
r, g, b = 0.667, 0.667, 1.0;
else
r, g, b = UnitSelectionColor(frame.unit, frame.optionTable.colorHealthWithExtendedColors);
end
elseif ( UnitIsFriend("player", frame.unit) ) then
r, g, b = 0.0, 1.0, 0.0;
else
r, g, b = 1.0, 0.0, 0.0;
end
end
end
if ( r ~= frame.healthBar.r or g ~= frame.healthBar.g or b ~= frame.healthBar.b ) then
frame.healthBar:SetStatusBarColor(r, g, b);
if (frame.optionTable.colorHealthWithExtendedColors) then
frame.ignoreParentAlpha.selectionHighlight:SetVertexColor(r, g, b);
else
frame.ignoreParentAlpha.selectionHighlight:SetVertexColor(1, 1, 1);
end
frame.healthBar.r, frame.healthBar.g, frame.healthBar.b = r, g, b;
end
end
там где код цвета, сами файлы CompactUnitFrame.lua CompactUnitFrame.xml