Skip to content

Commit

Permalink
[oUF] Upstream update f939159..955f942
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Renström committed Feb 27, 2014
1 parent 2320bba commit e16a5b8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Interface/AddOns/oUF/colors.lua
Expand Up @@ -77,9 +77,9 @@ local RGBColorGradient = function(...)
end
end


-- HCY functions are based on http://www.chilliant.com/rgb2hsv.html
local function GetY(r, g, b)
return 0.3 * r + 0.59 * g + 0.11 * b
return 0.299 * r + 0.587 * g + 0.114 * b
end

local function RGBToHCY(r, g, b)
Expand All @@ -102,7 +102,7 @@ end
local abs = math.abs
local function HCYtoRGB(hue, chroma, luma)
local r, g, b = 0, 0, 0
if hue then
if hue and luma > 0 then
local h2 = hue * 6
local x = chroma * (1 - abs(h2 % 2 - 1))
if h2 < 1 then
Expand All @@ -118,9 +118,17 @@ local function HCYtoRGB(hue, chroma, luma)
else
r, g, b = chroma, 0, x
end
local y = GetY(r, g, b)
if luma < y then
chroma = chroma * (luma / y)
elseif y < 1 then
chroma = chroma * (1 - luma) / (1 - y)
end
r = (r - y) * chroma + luma
g = (g - y) * chroma + luma
b = (b - y) * chroma + luma
end
local m = luma - GetY(r, g, b)
return r + m, g + m, b + m
return r, g, b
end

local HCYColorGradient = function(...)
Expand Down
1 change: 1 addition & 0 deletions Interface/AddOns/oUF/elements/stagger.lua
Expand Up @@ -141,6 +141,7 @@ local Enable = function(self, unit)
if(element) then
element.__owner = self
element.ForceUpdate = ForceUpdate
element:Hide()

color = self.colors.power[BREWMASTER_POWER_BAR_NAME]

Expand Down

0 comments on commit e16a5b8

Please sign in to comment.