Colours API

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: Basic terminals (such as the Computer and Monitor) only support the greyscale colours: white, lightGrey, grey and black.

 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

Functioncolours.combine
Combines given colours into the union of all input colours.
Syntax colours.combine(
  • colour... : number
)
Returns number
Part of CC:Tweaked (source)
API colours
See also colours.substract
ExampleCombining 3 colours
Combine white, light blue and magenta to yield 13 (the bitwise combination of the colors)
Code
<nowiki>
colours.combine(colours.white, colours.lightBlue, colours.magenta)
    </nowiki>
Output 13
Functioncolours.subtract
Subtracts given colours from the first given colour.
Syntax colours.subtract(
  • colour... : number
)
Returns number
Part of CC:Tweaked (source)
API colours
See also colours.combine
ExampleSubtracting 2 colours from one initial colour
Subtracting orange and white from lime.
Code
<nowiki>
colours.subtract(colours.lime, colours.orange, colours.white)
    </nowiki>
Output 32

Colours.test Colours.rgb8

gollark: All my good useless code is still extremely large, though.
gollark: Weird.
gollark: I resent this.
gollark: Observe.
gollark: All of my *good* useless code has imports, is long and has pass statements, and contains loops.
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.