Mariomarco

OPEssentials

Sep 15th, 2013
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.82 KB | None | 0 0
  1. -- CODE --
  2. local glassesTerminal = peripheral.warp("back")
  3.  
  4. drawBoxGradient(5,5,20,15,  0.6,0,0,0,  0.3,0,0,0)
  5.  
  6. function drawBox(xPos, yPos, width, height, color, opacity)
  7.     glassesTerminal.addBox(xPos, yPos, width, height, color, opacity)
  8. end
  9. function drawBoxGradient(xPos, yPos, width, height,  FO,FR,FG,FB,  TO,TR,TG,TB)
  10.     local I = 1
  11.     while I <= height do
  12.         local rgbcolor = {}
  13.         rgbcolor["r"] =  math.ceil((FR - TR)) / height * I  + FR
  14.         rgbcolor["g"] =  math.ceil((FG - TG)) / height * I  + FG
  15.         rgbcolor["b"] =  math.ceil((FB - TB)) / height * I  + FB
  16.         glassesTerminal.addBox(xPos, yPos + I, width, 1,rgbToHex(rgbcolor) , math.ceil((FO - TO)) / height * I  + FO)
  17.         I = I +1
  18.     end
  19. end
  20.  
  21. local function rgbToHex(c)
  22.     local output = decToHex(c["r"]) .. decToHex(c["g"]) .. decToHex(c["b"]);
  23.     return "0x" .. output
  24. end
Advertisement
Add Comment
Please, Sign In to add comment