Romain Francois, Professional R Enthusiast - xterm256 - CommentsIndependant statistical/R consultant2013-03-24T15:53:22+01:00Romain Francoisurn:md5:2cdb21a695f56bfe2b31ee2133c51b42DotclearColorful terminal: the R package "xterm256" - astgabelurn:md5:34694f65a3a1efbba5c12a633474aaba2010-08-09T16:24:12+02:00astgabel<p>Hi,<br />
is this package intended to give colored R code when programming in the terminal?</p>Colorful terminal: the R package "xterm256" - alessandrourn:md5:6cb3ae0088e643ce556848cf895ff9182010-07-26T13:14:46+02:00alessandro<p>why do i get the following error?<br />
Warning: dependency âhighlightâ is not available</p>
<p>platform i486-pc-linux-gnu<br />
arch i486<br />
os linux-gnu<br />
system i486, linux-gnu<br />
status<br />
major 2<br />
minor 10.1<br />
year 2009<br />
month 12<br />
day 14<br />
svn rev 50720<br />
language R<br />
version.string R version 2.10.1 (2009-12-14)<br />
> install.packages("xterm256")<br />
Warning in install.packages("xterm256") :</p>
<pre> argument 'lib' is missing: using '/home/ale/R/i486-pc-linux-gnu-library/2.10'</pre>
<p>Warning: dependency âhighlightâ is not available<br />
trying URL '<a href="http://rm.mirror.garr.it/mirrors/CRAN/src/contrib/xterm256_0.1-2.tar.gz'" title="http://rm.mirror.garr.it/mirrors/CRAN/src/contrib/xterm256_0.1-2.tar.gz'" rel="nofollow">http://rm.mirror.garr.it/mirrors/CR...</a><br />
Content type 'application/x-gzip' length 11886 bytes (11 Kb)<br />
opened URL<br />
==================================================<br />
downloaded 11 Kb</p>
<ul>
<li>installing *source* package âxterm256â ...
<ul>
<li>R</li>
<li>inst</li>
<li>preparing package for lazy loading</li>
</ul></li>
</ul>
<p>Error : package 'highlight' required by 'xterm256' could not be found<br />
ERROR: lazy loading failed for package âxterm256â</p>
<ul>
<li>removing â/home/ale/R/i486-pc-linux-gnu-library/2.10/xterm256â</li>
</ul>
<p>The downloaded packages are in</p>
<pre> â/tmp/RtmpRRwfvk/downloaded_packagesâ</pre>
<p>Warning message:<br />
In install.packages("xterm256") :</p>
<pre> installation of package 'xterm256' had non-zero exit status</pre>Colorful terminal: the R package "xterm256" - anonurn:md5:b079e9f0ed363a5850a911848c7a27472009-11-05T04:38:50+01:00anon<p>Cool. Any way this can be used to change the color of *all* R output? It's quite annoying working on a terminal with everything being the same color. Just having a different color for any output would be extremely helpful, being able to separate the code from the output. Even better would be yet another color for errors.</p>Colorful terminal: the R package "xterm256" - Bryanurn:md5:12340417456284fc1b1e9f887c0efe982009-04-25T15:12:17+02:00Bryan<p>This package really has a lot of potential. Thanks for your work. I am anxious to see highlight package as well.</p>Colorful terminal: the R package "xterm256" - Paolourn:md5:15f9456b7f6cb897c49966f840e002202009-04-22T12:29:27+02:00Paolo<p>Your solution is much more elegant than mine, very neat! I think this package will be very useful, among other things, in the quick selection of pleasant colors for EDA plots! Well done!</p>Colorful terminal: the R package "xterm256" - Romain Francoisurn:md5:1067ff1cc8fba846cd2f669bfd9c84e22009-04-21T21:55:50+02:00Romain Francois<p>Hi,</p>
<p>Or you can so that:</p>
<pre>
> colorme <- function( col ) cat( style( col, fg = col ), "\n" )
</pre>
<p>or</p>
<pre>
colorme <- function( ..., cols = unlist(list(...)) ) cat( paste( style( cols, fg = cols ), sep = " " ),"\n" )
</pre>
<a href="http://romainfrancois.blog.free.fr/public/posts/xterm256/palette.png" rel="nofollow"><img src="http://romainfrancois.blog.free.fr/public/posts/xterm256/.palette_m.jpg" alt="palette.png" style="margin: 0 auto; display: block;" title="palette.png, avr. 2009" /></a>
<p>There are also a few functions that are not exposed currently but that might be of interest:</p>
<pre>
> xterm256:::xtermColor.character( "orange" )
[1] 214
> xterm256:::xtermColor.character( "#ff0000" )
[1] 196
</pre>
<p>Romain</p>Colorful terminal: the R package "xterm256" - Paolourn:md5:26ca1fe83ed0cbf92a6229ce32d93caa2009-04-21T14:48:05+02:00Paolo<p>So useful! Thanks a lot! The function below returns the built-in color names printed in the matching color:</p>
<p>colors2 <- function(col=NULL){<br />
require(xterm256)<br />
cl <- colors()<br />
if(length(col)==0){<br />
for (i in 1:length(cl)){<br />
cat(style(cl<a href="http://romainfrancois.blog.free.fr/index.php?post/2009/04/18/i" title="i" rel="nofollow">i</a>, fg=cl<a href="http://romainfrancois.blog.free.fr/index.php?post/2009/04/18/i" title="i" rel="nofollow">i</a>), "\n")<br />
}<br />
}<br />
else if(col%in%cl){<br />
cat(style(col, fg=col), "\n")<br />
}<br />
else {<br />
warning(call.=FALSE, "Type either colors() or colors2() to see all the available color names.")<br />
}<br />
}</p>
<p>HIH!</p>