Advertisement
Masterjun

getColor

Feb 25th, 2017
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.33 KB | None | 0 0
  1. local function getColor(number,x_middle,x_max)
  2.   local color
  3.   if number<=x_middle then
  4.     local value = math.floor(0xFF*(number/x_middle))
  5.     color = 0xFF0000 + value*0x101
  6.   else
  7.     local value = math.floor(0xFF*(1-(number-x_middle)/(x_max-x_middle)))
  8.     color = 0x00FF00 + value*0x10001
  9.   end
  10.   return color+0xFF000000
  11. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement