ansicolors.lua
ansicolors.lua copied to clipboard
ANSI terminal color manipulation for Lua.
Attempt at #10, adds a method to manually enable/disable the functionality. And adds better Windows detection when setting the default value for `enabled`.
Windows has gained suppprt for ANSI sequences (since 2019, a specific release of 2010 added it). - ANSI sequences are available - might not be enabled by default - Windows...
If the string passed to `colors()` contains `%{...}` sequences which _aren't_ colours, then an exception is thrown: ```lua > local colors = require 'ansicolors'; print(colors('%{red}%{example}')) /usr/local/share/lua/5.2/ansicolors.lua:79: Unknown key: example stack...