WoW:USERAPI RGBPercToHex: Difference between revisions

m
Imp RGBPercToHex
No edit summary
 
m (Imp RGBPercToHex)
Line 5: Line 5:


  local function RGBPercToHex(r, g, b)
  local function RGBPercToHex(r, g, b)
return string.format("%02x%02x%02x", r*255, g*255, b*255)
    if r > 1 or r < 0 then
        r = 0
    end
    if g > 1 or g < 0 then
        g = 0
    end
    if b > 1 or b < 0 then
        b = 0
    end
    return string.format("%02x%02x%02x", r*255, g*255, b*255)
  end
  end
Anonymous user