term.getPaletteColour

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

term.getPaletteColour
Function
Syntax
term.getPaletteColour()
Returns number red, number green, number blue
API term
Source CC:Tweaked (source)

Returns the RGB values (0–1) of the specified palette colour of the terminal object.

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