LayZee

ComputerCraft Colors

May 25th, 2013
617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.09 KB | None | 0 0
  1. -- lzColor v0.1 -- (C) LayZee 2013
  2. black     = colors.black
  3. blue      = colors.blue
  4. brown     = colors.brown
  5. cyan      = colors.cyan
  6. gray      = colors.gray
  7. green     = colors.green
  8. lightBlue = colors.lightBlue
  9. lightGray = colors.lightGray
  10. lime      = colors.lime
  11. magenta   = colors.magenta
  12. orange    = colors.orange
  13. pink      = colors.pink
  14. purple    = colors.purple
  15. red       = colors.red
  16. white     = colors.white
  17. yellow    = colors.yellow
  18.  
  19. function newLine (x)
  20.   local currentX, y = term.getCursorPos()
  21.   x = x or 1
  22.  
  23.   term.setCursorPos(x, y + 1)
  24. end
  25.  
  26. function defaultText ()
  27.   term.setBackgroundColor(black)
  28.   term.setTextColor(white)
  29. end
  30.  
  31. function defaultSpace ()
  32.   defaultText()
  33.   term.write(" ")
  34. end
  35.  
  36. function list ()
  37.   if not term.isColor() then
  38.     print("Colors are not supported. Build an Advanced Computer or Monitor.")
  39.    
  40.     return
  41.   end
  42.  
  43.   term.write("black")
  44.   defaultSpace()
  45.   term.setBackgroundColor(blue)
  46.   term.write("blue")
  47.   defaultSpace()
  48.   term.setBackgroundColor(brown)
  49.   term.write("brown")
  50.   defaultSpace()
  51.   term.setBackgroundColor(cyan)
  52.   term.write("cyan")
  53.   defaultSpace()
  54.   term.setBackgroundColor(gray)
  55.   term.write("gray")
  56.   newLine()
  57.   term.setBackgroundColor(green)
  58.   term.write("green")
  59.   defaultSpace()
  60.   term.setBackgroundColor(lightBlue)
  61.   term.write("lightBlue")
  62.   defaultSpace()
  63.   term.setBackgroundColor(lightGray)
  64.   term.write("lightGray")
  65.   newLine()
  66.   term.setBackgroundColor(lime)
  67.   term.write("lime")
  68.   defaultSpace()
  69.   term.setBackgroundColor(magenta)
  70.   term.write("magenta")
  71.   defaultSpace()
  72.   term.setBackgroundColor(orange)
  73.   term.write("orange")
  74.   defaultSpace()
  75.   term.setBackgroundColor(pink)
  76.   term.write("pink")
  77.   newLine()
  78.   term.setBackgroundColor(purple)
  79.   term.write("purple")
  80.   defaultSpace()
  81.   term.setBackgroundColor(red)
  82.   term.write("red")
  83.   defaultSpace()
  84.   term.setBackgroundColor(white)
  85.   term.setTextColor(black)
  86.   term.write("white")
  87.   defaultSpace()
  88.   term.setBackgroundColor(yellow)
  89.   term.setTextColor(black)
  90.   term.write("yellow")
  91.   defaultText()
  92.   newLine()
  93. end
  94.  
  95. list()
Advertisement
Add Comment
Please, Sign In to add comment