Discord
Login
Community
DARK THEME

Inlining text color changes in a draw call

Hello, is there a way to "inline" text color changes in a text draw call?

For example, "You see Farmer" I'd like to change the Farmer to a different color (like green) and otherwise text be white.

Thanks!

TextColor = function( x, y, text, size, color )
  //  screen.setColor(color)
  screen.drawText( text, x, y, size, color )
  return screen.textWidth( text, size )
end



draw = function()
  screen.clear("red")
  size = TextColor( 0, 0, "You see ", 20, "black")
  size += TextColor( 0 + size, 0, "Farmer", 20 , "green" )
end

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community