Add multiline support to colorize. (#5444)

This commit is contained in:
red-001 2017-03-24 07:36:29 +00:00 committed by Loïc Blot
parent 072bbba69a
commit dd2f1d7551

@ -667,7 +667,14 @@ else
end end
function core.colorize(color, message) function core.colorize(color, message)
return core.get_color_escape_sequence(color) .. message .. core.get_color_escape_sequence("#ffffff") local lines = message:split("\n", true)
local color_code = core.get_color_escape_sequence(color)
for i, line in ipairs(lines) do
lines[i] = colour_code .. line
end
return table.concat(lines, "\n") .. core.get_color_escape_sequence("#ffffff")
end end
end end