Type Function Object TextBox Library native.* Return value none Revision Release 2025.3721 Keywords setTextColor, color, text See also native.newTextBox()
Sets the color of the text in a native text input box.
object:setTextColor( r, g, b ) object:setTextColor( r, g, b, a )
Number. A value between 0 and 1 for red, green, and blue channels.
Number. A value between 0 and 1 for the alpha channel. Default is 1. This can not be changed on Windows.
If you are passing a table of color values to this function, the table must be unpacked so that the color values are dictated properly:
local textBox = native.newTextBox( 160, 240, 280, 140 )
local colorTable = { 1, 0, 0, 0.5 }
textBox:setTextColor( unpack(colorTable) )
local textBox = native.newTextBox( 160, 240, 280, 140 ) textBox.font = native.newFont( "Helvetica-Bold", 18 ) textBox:setTextColor( 0.8, 0.8, 0.8 ) textBox.alpha = 1.0 textBox.hasBackground = false textBox.text = "Hello World!"