Difference between revisions of "Color (API)"

From ComputerCraft Wiki
Jump to: navigation, search
(Tidy parameter list a bit)
(added bit values for colours)
Line 18: Line 18:
 
Color constants include, in ascending bit order:
 
Color constants include, in ascending bit order:
  
* colors.white
+
* colors.white = 1
* colors.orange
+
* colors.orange = 2
* colors.magenta
+
* colors.magenta = 4
* colors.lightBlue
+
* colors.lightBlue = 8
* colors.yellow  
+
* colors.yellow = 16
* colors.lime
+
* colors.lime = 32
* colors.pink
+
* colors.pink = 64
* colors.gray
+
* colors.gray = 128
* colors.lightGray
+
* colors.lightGray = 256
* colors.cyan
+
* colors.cyan = 512
* colors.purple
+
* colors.purple = 1024
* colors.blue
+
* colors.blue = 2048
* colors.brown
+
* colors.brown = 4096
* colors.green
+
* colors.green = 8192
* colors.red
+
* colors.red = 16384
* colors.black
+
* colors.black = 32768
 
[[Category:APIs]]
 
[[Category:APIs]]

Revision as of 12:29, 30 March 2012

The Colors API allows you to mess with colors. For the British just replace 'color' with 'colour' and it will use the other API, colours, which is just a British version.

Its functions are:

Method name Description
colors.combine(color1, color2, …) Combines a set of colors (or sets of colors) into a larger set
colors.subtract(colors, color1, color2, …) Removes one or more colors (or sets of colors) from an initial set
colors.test(colors, color) Tests whether a given color (or set of colors) is contained within a set

Color constants include, in ascending bit order:

  • colors.white = 1
  • colors.orange = 2
  • colors.magenta = 4
  • colors.lightBlue = 8
  • colors.yellow = 16
  • colors.lime = 32
  • colors.pink = 64
  • colors.gray = 128
  • colors.lightGray = 256
  • colors.cyan = 512
  • colors.purple = 1024
  • colors.blue = 2048
  • colors.brown = 4096
  • colors.green = 8192
  • colors.red = 16384
  • colors.black = 32768