Rolcam

Computercraft Tutorial - Section 5 - Colors

Jun 14th, 2021 (edited)
777
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --This is part of a Computercraft Programming Teaching Program
  2.  
  3. tSides = {"left","right","bottom","top","front","back"}
  4.  
  5. for i = 1, #tSides do
  6.   monitor = peripheral.wrap(tSides[i])
  7.   if monitor then
  8.         side = tSides[i]
  9.         break
  10.   end
  11. end
  12. --Prevents program termination
  13. os.pullEvent = os.pullEventRaw
  14. term.redirect(peripheral.wrap(side))
  15.  
  16. -- Resets Screen
  17. function reset()
  18. term.setTextColor(colors.white)
  19. term.setBackgroundColor(colors.black)
  20. term.clear()
  21. term.setCursorPos(1,1)
  22. end
  23.  
  24. reset()
  25. print("Section 5: Colors \n ")
  26. term.setTextColor(colors.cyan)
  27. print("term.setTextColor(colors.cyan) - changes the color of any new text being printed. It WON'T change the text already on screen")
  28. term.setBackgroundColor(colors.gray)
  29. print("term.setBackgroundColor(colors.gray) - Changes the background for new text being printed")
  30. print("to change the entire background, use \"term.clear()\" after this")
  31. print("You can use any of the 16 vanilla dye colors for the colors utility")
  32. term.setTextColor(colors.white)
  33. term.setBackgroundColor(colors.black)
  34. term.restore()
RAW Paste Data