in reply to Is it possible to include colored text in formatted output using write
can you provide a Short, Self-Contained, Correct Example to show how you use format? I am uninitiated.
print with sprintf works fine for me:
use Term::ANSIColor qw (color colored colorstrip :constants); my $x = sprintf '%s XYZ', "Hello ".colored("there", "green")." and bye +."; print $x; print sprintf("123 %s 456 %s 789\n", colored("hello", "red").sprintf("abc %s xyz", colored("bye", "green") ), $x );
Dirty hack: re-escaping refreshing the ANSI escape sequence in The purpose of the [32mts [0m script... works for me with (the naive) =~ s/\[/\033[/g;
bw, bliako
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Is it possible to include colored text in formatted output using write
by 1nickt (Canon) on May 11, 2023 at 22:38 UTC | |
|
Re^2: Is it possible to include colored text in formatted output using write
by fireblood (Scribe) on May 11, 2023 at 22:56 UTC |