mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 16:15:20 +02:00
Colored chat working as expected for both freetype and non-freetype builds. @nerzhul improvements * Add unit tests * Fix coding style * move guiChatConsole.hpp to client/
This commit is contained in:
@@ -197,3 +197,20 @@ function core.http_add_fetch(httpenv)
|
||||
|
||||
return httpenv
|
||||
end
|
||||
|
||||
function core.get_color_escape_sequence(color)
|
||||
--if string.len(color) == 3 then
|
||||
-- local r = string.sub(color, 1, 1)
|
||||
-- local g = string.sub(color, 2, 2)
|
||||
-- local b = string.sub(color, 3, 3)
|
||||
-- color = r .. r .. g .. g .. b .. b
|
||||
--end
|
||||
|
||||
--assert(#color == 6, "Color must be six characters in length.")
|
||||
--return "\v" .. color
|
||||
return "\v(color;" .. color .. ")"
|
||||
end
|
||||
|
||||
function core.colorize(color, message)
|
||||
return core.get_color_escape_sequence(color) .. message .. core.get_color_escape_sequence("ffffff")
|
||||
end
|
||||
|
Reference in New Issue
Block a user