Colours API

From ComputerCraft
(Redirected from Colour)
Jump to: navigation, search

Constants

All colour constants in the Colours API are number values. These numbers can be passed to term.setTextColour, term.setPaletteColour, et cetera to yield the appropriate default palette colour.
Note Note: When using custom palettes, the names of the colours constants may not correspond to the actual colours being displayed.

Colour Value Default Palette Representation
Decimal Hexadecimal Paint/Blit Sample Hex RGB
colours.white 1 0x1 0 #F0F0F0 240, 240, 240
colours.orange 2 0x2 1 #F2B233 242, 178, 51
colours.magenta 4 0x4 2 #E57FD8 229, 127, 216
colours.lightBlue 8 0x8 3 #99B2F2 153, 178, 242
colours.yellow 16 0x10 4 #DEDE6C 222, 222, 108
colours.lime 32 0x20 5 #7FCC19 127, 204, 25
colours.pink 64 0x40 6 #F2B2CC 242, 178, 204
colours.grey 128 0x80 7 #4C4C4C 76, 76, 76
colours.lightGrey 256 0x100 8 #999999 153, 153, 153
colours.cyan 512 0x200 9 #4C99B2 76, 153, 178
colours.purple 1024 0x400 a #B266E5 178, 102, 229
colours.blue 2048 0x800 b #3366CC 51, 102, 204
colours.brown 4096 0x1000 c #7F664C 127, 102, 76
colours.green 8192 0x2000 d #57A64E 87, 166, 78
colours.red 16384 0x4000 e #CC4C4C 204, 76, 76
colours.black 32768 0x8000 f #111111 17, 17, 17

Functions

FunctionFunctioncolours.combine
Combines given colours into the union of all input colours.
Syntax colours.combine()
Returns number
Part of CC:Tweaked (source)
API colours
See also colours.substract
ExampleExampleCombining 3 colours
Combine white, light blue and magenta to yield 13 (the bitwise combination of the colors)
Code
colours.combine(colours.white, colours.lightBlue, colours.magenta)
Output 13


FunctionFunctioncolours.subtract
Subtracts given colours from the first given colour.
Syntax colours.subtract()
Returns number
Part of CC:Tweaked (source)
API colours
See also colours.combine
ExampleExampleSubtracting 2 colours from one initial colour
Subtracting orange and white from lime.
Code
colours.subtract(colours.lime, colours.orange, colours.white)
Output 32

Colours.test Colours.rgb8