Difference between revisions of "Colors (API)"
From ComputerCraft Wiki
(→Colors) |
|||
Line 24: | Line 24: | ||
! Decimal | ! Decimal | ||
! Hexadecimal | ! Hexadecimal | ||
+ | ! Binary | ||
|- | |- | ||
| colors.white | | colors.white | ||
| align="right" | 1 | | align="right" | 1 | ||
| align="right" | 0x1 | | align="right" | 0x1 | ||
+ | | align="right" | 0000000000000001 | ||
|- | |- | ||
| colors.orange | | colors.orange | ||
| align="right" | 2 | | align="right" | 2 | ||
| align="right" | 0x2 | | align="right" | 0x2 | ||
+ | | align="right" | 0000000000000010 | ||
|- | |- | ||
| colors.magenta | | colors.magenta | ||
| align="right" | 4 | | align="right" | 4 | ||
| align="right" | 0x4 | | align="right" | 0x4 | ||
+ | | align="right" | 0000000000000100 | ||
|- | |- | ||
| colors.lightBlue | | colors.lightBlue | ||
| align="right" | 8 | | align="right" | 8 | ||
| align="right" | 0x8 | | align="right" | 0x8 | ||
+ | | align="right" | 0000000000001000 | ||
|- | |- | ||
| colors.yellow | | colors.yellow | ||
| align="right" | 16 | | align="right" | 16 | ||
| align="right" | 0x10 | | align="right" | 0x10 | ||
+ | | align="right" | 0000000000010000 | ||
|- | |- | ||
| colors.lime | | colors.lime | ||
| align="right" | 32 | | align="right" | 32 | ||
| align="right" | 0x20 | | align="right" | 0x20 | ||
+ | | align="right" | 0000000000100000 | ||
|- | |- | ||
| colors.pink | | colors.pink | ||
| align="right" | 64 | | align="right" | 64 | ||
| align="right" | 0x40 | | align="right" | 0x40 | ||
+ | | align="right" | 0000000001000000 | ||
|- | |- | ||
| colors.gray | | colors.gray | ||
| align="right" | 128 | | align="right" | 128 | ||
| align="right" | 0x80 | | align="right" | 0x80 | ||
+ | | align="right" | 0000000010000000 | ||
|- | |- | ||
| colors.lightGray | | colors.lightGray | ||
| align="right" | 256 | | align="right" | 256 | ||
| align="right" | 0x100 | | align="right" | 0x100 | ||
+ | | align="right" | 0000000100000000 | ||
|- | |- | ||
| colors.cyan | | colors.cyan | ||
| align="right" | 512 | | align="right" | 512 | ||
| align="right" | 0x200 | | align="right" | 0x200 | ||
+ | | align="right" | 0000001000000000 | ||
|- | |- | ||
| colors.purple | | colors.purple | ||
| align="right" | 1024 | | align="right" | 1024 | ||
| align="right" | 0x400 | | align="right" | 0x400 | ||
+ | | align="right" | 0000010000000000 | ||
|- | |- | ||
| colors.blue | | colors.blue | ||
| align="right" | 2048 | | align="right" | 2048 | ||
| align="right" | 0x800 | | align="right" | 0x800 | ||
+ | | align="right" | 0000100000000000 | ||
|- | |- | ||
| colors.brown | | colors.brown | ||
| align="right" | 4096 | | align="right" | 4096 | ||
| align="right" | 0x1000 | | align="right" | 0x1000 | ||
+ | | align="right" | 0001000000000000 | ||
|- | |- | ||
| colors.green | | colors.green | ||
| align="right" | 8192 | | align="right" | 8192 | ||
| align="right" | 0x2000 | | align="right" | 0x2000 | ||
+ | | align="right" | 0010000000000000 | ||
|- | |- | ||
| colors.red | | colors.red | ||
| align="right" | 16384 | | align="right" | 16384 | ||
| align="right" | 0x4000 | | align="right" | 0x4000 | ||
+ | | align="right" | 0100000000000000 | ||
|- | |- | ||
| colors.black | | colors.black | ||
| align="right" | 32768 | | align="right" | 32768 | ||
| align="right" | 0x8000 | | align="right" | 0x8000 | ||
+ | | align="right" | 1000000000000000 | ||
|} | |} | ||
[[Category:APIs]] | [[Category:APIs]] |
Revision as of 18:45, 17 September 2012
The Colors API allows you to mess with colored cable from the RedPower Mod. For the non-American English Version just replace 'color' with 'colour' and it will use the other API, colours, which is exactly the same, except in non-American English (e.g. gray is spelt grey and lightGray is spelt lightGrey).
Methods
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 |
Colors
Color constants include, in ascending bit order:
Color | Decimal | Hexadecimal | Binary |
---|---|---|---|
colors.white | 1 | 0x1 | 0000000000000001 |
colors.orange | 2 | 0x2 | 0000000000000010 |
colors.magenta | 4 | 0x4 | 0000000000000100 |
colors.lightBlue | 8 | 0x8 | 0000000000001000 |
colors.yellow | 16 | 0x10 | 0000000000010000 |
colors.lime | 32 | 0x20 | 0000000000100000 |
colors.pink | 64 | 0x40 | 0000000001000000 |
colors.gray | 128 | 0x80 | 0000000010000000 |
colors.lightGray | 256 | 0x100 | 0000000100000000 |
colors.cyan | 512 | 0x200 | 0000001000000000 |
colors.purple | 1024 | 0x400 | 0000010000000000 |
colors.blue | 2048 | 0x800 | 0000100000000000 |
colors.brown | 4096 | 0x1000 | 0001000000000000 |
colors.green | 8192 | 0x2000 | 0010000000000000 |
colors.red | 16384 | 0x4000 | 0100000000000000 |
colors.black | 32768 | 0x8000 | 1000000000000000 |