zsh-users
 help / color / mirror / code / Atom feed
* print color escapes
@ 2015-01-01  5:47 Ray Andrews
  2015-01-01  6:35 ` Bart Schaefer
  0 siblings, 1 reply; 15+ messages in thread
From: Ray Andrews @ 2015-01-01  5:47 UTC (permalink / raw)
  To: Zsh Users

All,

     $ print -r "\e[36msome cyanide salts are cyan\e[0m"
\e[36msome cyanide salts are cyan\e[0m

... does as expected, but how does one achieve the same 'literalness' if 
color escapes are in variables? I was forcing the 'colors' array to 
print bold colors and in the process the only way I could figure out to 
print the actual values of the 'fg[color]' colors was like this:

     $ print -r "before $($fg[cyan]) after"
     command not found: ^[[36m

... which is a bit clumsy, but it does at least show what's in there.  I 
tried various things, but can't find a legit way of printing the values 
of the color escapes.  How should it be done? Single quotes obviously 
won't work, double quotes seem needed to expand the variable, but I 
haven't found a way to stop it from being de-literalized.  But there 
will be a way.  Probably some magic nesting of braces. I'd expect 'print 
-r' to 'stay literal' with the expanded variable but no luck.


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-01-02 17:43 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-01  5:47 print color escapes Ray Andrews
2015-01-01  6:35 ` Bart Schaefer
2015-01-01 19:24   ` Ray Andrews
2015-01-01 21:29     ` Bart Schaefer
2015-01-01 23:02       ` Ray Andrews
2015-01-01 23:26         ` Bart Schaefer
2015-01-02  2:30           ` Ray Andrews
2015-01-02  2:45             ` Kurtis Rader
2015-01-02  3:50               ` Ray Andrews
2015-01-02  4:18                 ` Bart Schaefer
2015-01-02 17:43                   ` Ray Andrews
2015-01-02  1:21         ` Kurtis Rader
2015-01-02  2:39           ` Ray Andrews
2015-01-02  2:58             ` Kurtis Rader
2015-01-02  3:48               ` Ray Andrews

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).