term.getPaletteColour

Returns the RGB values (01) of the specified palette colour of the terminal object.

ExampleGet specific palette colour
Prints the decimal RGB value of the colour red in the current term's palette.
Code
<nowiki>
local red, green, blue = term.getPaletteColour(colours.red)
print(red, green, blue)
  </nowiki>
Output 0.80000001192093 0.29803922772408 0.29803922772408 (equivalent to #cc4c4c)
ExampleGet current palette colour
Prints the decimal RGB value of the current term's text colour.
Code
<nowiki>
local colour = term.getTextColour()
local red, green, blue = term.getPaletteColour(colour)
print(red, green, blue)
  </nowiki>
Output 0.94117647409439 0.94117647409439 0.94117647409439 (equivalent to #f0f0f0)

term.getPaletteColour
Function
Syntax
term.getPaletteColour(
  • colour : number
)

Returns number red, number green, number blue
API term
Source CC:Tweaked (source)
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.