term.setPaletteColour

From ComputerCraft
(Redirected from Term.setPaletteColor)
Jump to: navigation, search

term.setPaletteColour
Function
Syntax
term.setPaletteColour(
)

term.setPaletteColour(
)

Returns nil
API term
Source CC:Tweaked (source)

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.

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 (0–1) representing the red, green and blue channels individually, e.g. 1.0, 0.0, 0.0 to produce the colour .
ExampleExampleUsing hex code
Changes the red colour from the default (#cc4c4c) to #FF0000.
Code
term.setPaletteColour(colours.red, 0xFF0000)
term.setTextColour(colours.red)
print("Hello, world!")
Output Demo term.setPaletteColour.png
ExampleExampleUsing separate RGB floats
Changes the red colour from the default (#cc4c4c) to #FF0000.
Code
term.setPaletteColour(colours.red, 1, 0, 0)
term.setTextColour(colours.red)
print("Hello, world!")
Output Demo term.setPaletteColour.png