Skip to content
Permalink
Browse files

Add multiline support to colorize. (#5444)

  • Loading branch information...
red-001 authored and nerzhul committed Mar 24, 2017
1 parent 072bbba commit dd2f1d7551bfd70357ad4f3fb180704194272147
Showing with 8 additions and 1 deletion.
  1. +8 −1 builtin/common/misc_helpers.lua
@@ -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

0 comments on commit dd2f1d7

Please sign in to comment.
You can’t perform that action at this time.