Is there a colour output module in Lua?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there a colour output module in Lua?

Xavier Wang
Hi list,

I'm interesting in lua-repl. I think it can output colour text in a console. it can be done in windows with win32 api and linux with terminal-special-keys. But I'm wondering whether a cross-platform module to do colour output in lua like Color::Output[1] in Perl.

And if it not present, I think I can write one, so which API do you like is better?

Regards,
Xavier Wang.

Reply | Threaded
Open this post in threaded view
|

Re: Is there a colour output module in Lua?

Matthew Wild
On 29 September 2012 11:02, Xavier Wang <[hidden email]> wrote:
> Hi list,
>
> I'm interesting in lua-repl. I think it can output colour text in a console.
> it can be done in windows with win32 api and linux with
> terminal-special-keys. But I'm wondering whether a cross-platform module to
> do colour output in lua like Color::Output[1] in Perl.

I think there are a couple, I can't remember where/which. In case
you're interested we have our own small module for it in Prosody:
http://prosody.im/tip/util/termcolours.lua

Regards,
Matthew

Reply | Threaded
Open this post in threaded view
|

Re: Is there a colour output module in Lua?

Rob Hoelz-2
In reply to this post by Xavier Wang
On Sat, 29 Sep 2012 18:02:26 +0800
Xavier Wang <[hidden email]> wrote:

> Hi list,
>
> I'm interesting in lua-repl. I think it can output colour text in a
> console. it can be done in windows with win32 api and linux with
> terminal-special-keys. But I'm wondering whether a cross-platform
> module to do colour output in lua like Color::Output[1] in Perl.
>
> And if it not present, I think I can write one, so which API do you
> like is better?
>
> Regards,
> Xavier Wang.
>
> [1]: http://search.cpan.org/~animator/Color-Output-1.05/Output.pm
Hi Xavier,

I've written a module for this purpose:

http://github.com/hoelzro/lua-term

It doesn't support Windows (yet), but I would like it to eventually.

-Rob

signature.asc (205 bytes) Download Attachment