Escape sequences

Most text can contain escape sequences, that can for example color the text. There are a few exceptions: tab headers, dropdowns and vertical labels can't. The following functions provide escape sequences:

  • minetest.get_color_escape_sequence(color):
    • color is a ColorString
    • The escape sequence sets the text color to color
  • minetest.colorize(color, message):
    • Equivalent to: minetest.get_color_escape_sequence(color) .. message .. minetest.get_color_escape_sequence("#ffffff")
  • minetest.get_background_escape_sequence(color)
    • color is a ColorString
    • The escape sequence sets the background of the whole text element to color. Only defined for item descriptions and tooltips.
  • minetest.strip_foreground_colors(str)
    • Removes foreground colors added by get_color_escape_sequence.
  • minetest.strip_background_colors(str)
    • Removes background colors added by get_background_escape_sequence.
  • minetest.strip_colors(str)
    • Removes all color escape sequences.