Advertisement
ediblesushi

rainbow

Apr 1st, 2022 (edited)
1,201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.50 KB | None | 0 0
  1. local tArgs = { ... }
  2.  
  3. m = peripheral.find("monitor")
  4. m.setTextColor(colors.black)
  5. m.setTextScale(3)
  6.  
  7. local function centerText(m, text)
  8.     local x,y = m.getSize()
  9.     local x2,y2 = m.getCursorPos()
  10.     local fg, bg = ""
  11.     m.setCursorPos(math.ceil((x/2)-(text:len()/2)), math.ceil(y/2))
  12.     m.write(text)
  13. end
  14.  
  15. while true do
  16.         for i = 1, 14 do
  17.         centerText(m, tArgs[1], 2^i)
  18.         m.setBackgroundColor(2^i)
  19.         m.clear()
  20.         centerText(m, tArgs[1])
  21.         print("Color: "..m.getBackgroundColor())
  22.         sleep(0.2)
  23.     end
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement