term.setPaletteColour

Sets the RGB value of the specified palette colour of the terminal object. This allows you to change the appearance of all text and background using this colour.

term.setPaletteColour
Function
Syntax
term.setPaletteColour(
  • colour : number
  • rgb : number
)

term.setPaletteColour(
  • colour : number
  • red : number
  • green : number
  • blue : number
)

Returns nil
API term
Source CC:Tweaked (source)

The first argument is the colour that you want to change, e.g. colours.red. The arguments after that can either be:

  • An integer representing the hexadecimal RGB8 value of the colour, e.g. 0xFF0000 to produce the colour .
  • Three floats (01) representing the red, green and blue channels individually, e.g. 1.0, 0.0, 0.0 to produce the colour .
ExampleUsing hex code
Changes the red colour from the default (#cc4c4c) to #FF0000.
Code
<nowiki>
term.setPaletteColour(colours.red, 0xFF0000)
term.setTextColour(colours.red)
print("Hello, world!")
  </nowiki>
Output
ExampleUsing separate RGB floats
Changes the red colour from the default (#cc4c4c) to #FF0000.
Code
<nowiki>
term.setPaletteColour(colours.red, 1, 0, 0)
term.setTextColour(colours.red)
print("Hello, world!")
  </nowiki>
Output
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.