mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-16 18:01:40 +00:00
Add multiline support to colorize. (#5444)
This commit is contained in:
parent
072bbba69a
commit
dd2f1d7551
1 changed files with 8 additions and 1 deletions
|
@ -667,7 +667,14 @@ else
|
|||
end
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue