<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt">Thanks for your comments and trying it out, all of you!<br><br>I like the idea of mimicking what the terminal would look like so<br>I'll see if I can get Robby's idea to work.<br><br>---<br><br>As for printf-color, that was just an oversight, but I was<br>planning to add a high level formatting procedure to<br>format a message with multiple colors in one go, rather than<br>multiple calls. I just don't have the ability to do it yet.<br><br>e.g.<br>error: the value X is invalid. please make sure it follows Y.<br><br>error might want to be in red, and X in cyan to signify user data<br>from the rest of message.<br><br>At the moment you would have to do something like<br><br>(display-color "error:" #:fg 'red)<br>(display-color " the value " #:fg 'white)<br>(display-color X #:fg 'cyan)<br>(display-color " is invalid. please make sure
it follows " #:fg 'white)<br>(display-color Y #:fg 'green)<br>(newline)<br><br>it's cumbersome and not very readable. Where as something like (made up<br>just now)<br><br>(outputf-color "(error:) the value (~a) is invalid. please make sure it follows (~a).~n"<br> ([#:fg 'red])<br> (X [#:fg 'cyan])<br> (Y [#:fg 'green]))<br><br>shows the intent and the wanted output much clearer.<br><br>(outputf-color colored-format-string colored-args ...)<br><br>where colored-args is a list containing the data and a sublist each for<br>the the foreground and background color - all optional but at least<br>one must be supplied.<br><br>colored-format-string supports the standard formatting operators like printf,<br>but they
must be inside parentheses. Anything inside parentheses will be<br>considered valid to be colored according to the relevant argument,<br>processed from left-to-right.<br>Anything inside the parentheses that is not a formatting operator will<br>flow directly through to the output.<br><br>I'm open for suggestions on this too.<br><br>---<br><br>I'll give Gregg's idea a go as well too to reduce the repetition.<br><br>Cheers<div><br></div> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1"> <font face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></b> Asumu Takikawa <asumu@ccs.neu.edu><br> <b><span style="font-weight: bold;">To:</span></b> Richard Hopkins <richhguard-monotone@yahoo.co.uk> <br><b><span style="font-weight: bold;">Cc:</span></b> "users@racket-lang.org"
<users@racket-lang.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, 29 January 2015, 23:17<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [racket] terminal-color package - output colored text to the terminal - comments before release<br> </font> </div> <div class="y_msg_container"><br>On 2015-01-25 22:19:51 +0000, Richard Hopkins wrote:<br>> To help me learn Racket, and also because I find colored text useful I've<br>> been working on<br>> a Racket package which I aim to release on <a href="http://pkgs.racket-lang.org/" target="_blank">http://pkgs.racket-lang.org/</a><br><br>This is cool! I tried the examples on Linux and it works for me.<br><br>> * the API is right for end users<br><br>I noticed that a `printf-color` was missing. That might be handy.<br><br>> * the documentation is readable with decent examples<br><br>The docs
look good to me. One thing I might note in the "Examples"<br>section is that the output in the docs don't look like how it's supposed<br>to look in a real terminal.<br><br>Cheers,<br>Asumu<br><br><br></div> </div> </div> </div></body></html>