in reply to Re^2: Handling ANSI Escape Sequences for Printing to Curses
in thread Handling ANSI Escape Sequences for Printing to Curses

For a yellow "word"...
#!/usr/bin/perl use strict; use warnings; use Term::ANSIColor::Markup; my $text = qq{ <yellow>word</yellow> }; print Term::ANSIColor::Markup->colorize($text);

Replies are listed 'Best First'.
Re^4: Handling ANSI Escape Sequences for Printing to Curses
by atancasis (Sexton) on Aug 01, 2010 at 04:44 UTC

    Thanks! Although, I'm not having too much of a problem printing out colored text to the terminal. In fact, printing out $text in the first code snippet I posted will print "YELLOW" in yellow to the terminal.

    use Term::ANSIColor; print "a ".color('yellow')."YELLOW".color('reset')." word\n";

    The problem, however, is in trying to add the colorized string to an ncurses window wherein the ANSI escape sequences will be stringified and printed along with the message (instead of just modifying color attributes of the words).