Created
May 2, 2017 20:22
-
-
Save red-001/5c279faa2f4dfd6fef4fdb4a9a36ba7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ESCAPE_CHAR = string.char(0x1b) | |
core = {} | |
function core.get_color_escape_sequence(color) | |
return ESCAPE_CHAR .. "(c@" .. color .. ")" | |
end | |
function core.get_background_escape_sequence(color) | |
return ESCAPE_CHAR .. "(b@" .. color .. ")" | |
end | |
function core.colorize(color, message) | |
return core.get_color_escape_sequence(color) .. message | |
end | |
print(core.colorize("red", "colour test")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment