Advertisement
CaptainSpaceCat

iosutils

May 17th, 2015
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. w, h = term.getSize()
  2.  
  3. --Text Formatters--
  4. function leftAlign(string, h, txtcol, backcol)
  5.   term.setCursorPos(1, h)
  6.   if txtcol then
  7.     term.setTextColor(txtcol)
  8.   end
  9.   if backcol then
  10.     term.setBackgroundColor(backcol)
  11.   end
  12.   term.write(string)
  13. end
  14.  
  15. function centerAlign(string, h, txtcol, backcol)
  16.   term.setCursorPos(w / 2 - #string / 2 + 1, h)
  17.   if txtcol then
  18.     term.setTextColor(txtcol)
  19.   end
  20.   if backcol then
  21.     term.setBackgroundColor(backcol)
  22.   end
  23.   term.write(string)
  24. end
  25.  
  26. function rightAlign(string, h, txtcol, backcol)
  27.   term.setCursorPos(w - #string + 1)
  28.   if txtcol then
  29.     term.setTextColor(txtcol)
  30.   end
  31.   if backcol then
  32.     term.setBackgroundColor(backcol)
  33.   end
  34.   term.write(string)
  35. end
  36.  
  37. function resetText()
  38.   term.setBackgroundColor(colors.black)
  39.   term.setTextColor(colors.white)
  40. end
  41.  
  42. --Easier Colors API--
  43. colors = {}
  44. for i = 0, 15 do
  45.   colors[i + 1] = 2 ^ i
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement