From ripley at stats.ox.ac.uk  Wed Nov 21 19:20:24 2007
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 21 Nov 2007 18:20:24 +0000 (GMT)
Subject: [Rd] Color coding
In-Reply-To: <05FDD1814AFFAB408E15A0ABF3AAE6D80BADF3@intra2003.ric.si>
References: <05FDD1814AFFAB408E15A0ABF3AAE6D80BADF3@intra2003.ric.si>
Message-ID: <Pine.LNX.4.64.0711211520140.15091@gannet.stats.ox.ac.uk>

On Wed, 21 Nov 2007, Gasper Cankar wrote:

> I'm probably not the first with this idea so I guess that there's a
> complex issue behind it but since I couldn't find an answer I just
> though to ask:
>
> Wouldn't it be nice to have color coded objects as output of ls()
> statement? Functions of one color and rest with other (at least). So
> when I issue an ls() I could visually discern different types of
> objects.
>
> I often find myself opening old files and spending time figuring which
> is which. I know this just means I'm not aoranized, but still...color
> coding would help.

You haven't mentioned your platform: you would have to be working in a 
console which supported this, and e.g. the Windows GUI console does not.

Once you know the escape codes to change colour, it would be easy to write 
a listing function which did this.  You would almost certainly have to 
write some C code to find out what the codes are for the current terminal 
(on a modern system via the terminfo database): the GNU ls (part of 
coreutils) would provide you example code.

So, this is project for a package: are you volunteering?

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Color coding
Prof Brian Ripley