View Single Post
12-25-13, 10:13 PM   #1
Aanson
A Flamescale Wyrmkin
Join Date: Aug 2009
Posts: 124
Chat message colours

Hey all, Happy Christmas!

Just a quick question...

Does anyone know of a simple way to obtain the colour of the most recently shown text in the ChatFrames?

I have a function in my addon which makes a frame 'pulse' when a new message is received, kinda like:

Lua Code:
  1. ChatButton.Pulse = function(self)
  2.   self.fadeStep = ( (self.pulseIntensity * 2) / (self.pulseDuration * GetFramerate()) );
  3.   self.isFading = nil;
  4.   self.pulseTexture:SetTexture(1, 1, 1); -- [color="Red"]to match chatType colour[/color]
  5.   return ( self.pulseIsEnabled and (not self.alpha) ) and self:SetScript("OnUpdate", self.OnUpdate);
  6. end

This doesn't really relate to the question I guess, but the onupdate code is:

Lua Code:
  1. ChatButton.OnUpdate = function(self)
  2.   self.alpha = self.isFading and ( (self.alpha or 0) - self.fadeStep ) or ( (self.alpha or 0) + self.fadeStep );
  3.   if ( (self.alpha >= 0) and (self.alpha <= self.pulseIntensity) ) then
  4.     return self.pulseTexture:SetAlpha(self.alpha);
  5.   elseif self.isFading then
  6.     self.alpha, self.fadeStep, self.isFading = nil, nil, nil;
  7.     return self:SetScript("OnUpdate", nil);
  8.   end
  9.   self.alpha, self.isFading = self.pulseIntensity, true;
  10. end

Thanks in advance for any possible guidance

Aanson
__________________
__________________
  Reply With Quote