LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-25-2004, 11:57 AM   #1
virid
LQ Newbie
 
Registered: Mar 2004
Location: NYC
Distribution: Slackware
Posts: 9

Rep: Reputation: 0
Term colors


Can anyone tell me how to change the color shades used by "ls --color"?

I imagine that it maybe an some edit to /etc/DIR_COLORS but I cannot find any documentation on the matter. I am somewhat familiar with defining colors in my .bashrc for my command prompt (ie. BOLDPURPLE='\[\033[01;35m\]' && PURPLE='\[\033[00;35m\]'), but how do I change it from using a bright, bold colors to using soft, light colors? Can anyone point me in the right direction? I'm fine with reading through documentation if I can just find the right document! Thanks.

I want colors like this.
Not colors like this.
 
Old 03-25-2004, 12:06 PM   #2
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
the colors are in the same format, but without the escape sequence.
This from dircolors --print-database:
Code:
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
example: EXEC 01;32
executable files will be bright (bold) green
 
Old 03-25-2004, 12:16 PM   #3
virid
LQ Newbie
 
Registered: Mar 2004
Location: NYC
Distribution: Slackware
Posts: 9

Original Poster
Rep: Reputation: 0
How do you get the non-bright, bold colors?
 
Old 03-25-2004, 12:57 PM   #4
mikshaw
LQ Addict
 
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
use 00 instead of 01:
EXEC 00;32

If you mean "how to get bold but not bright"...I think bold and bright are synonymous in this case, so it won't happen.

You might be able to reassign the codes to other colors listed in rgb.txt, but this is just a guess....i kinda doubt it.
 
Old 03-25-2004, 02:34 PM   #5
virid
LQ Newbie
 
Registered: Mar 2004
Location: NYC
Distribution: Slackware
Posts: 9

Original Poster
Rep: Reputation: 0
Do you know a way to use colors listed in rgb.txt in either /etc/DIR_COLORS or .bashrc?
 
Old 03-25-2004, 10:03 PM   #6
bluej
LQ Newbie
 
Registered: Mar 2004
Location: japan
Distribution: debian
Posts: 24

Rep: Reputation: 15
i don't know if this what you were looking for, but just in case...

my problems was that the bold directory and symlink names were straining my eyes.
so i changed bold fonts to regular fonts, this is how:

1. dircolors -p > dircolors.dat

2. edit this file by hand.
under the TERM entries you'll find a brief explanation of color codes and attribute codes.
as i had no problem with the colors, i only wanted to change the attributes,
so i changed
DIR 01;34
LINK 01;36
to
DIR 00;34
LINK 00;36

3. dircolors dircolors.dat
this will output the code snippet that you should add to your bash startup script to have these colors enabled by default.
 
Old 01-02-2005, 05:50 AM   #7
jules_fraser
Member
 
Registered: Nov 2003
Location: London, UK
Distribution: Gentoo, RH (and, yes: M$2k)
Posts: 77

Rep: Reputation: 15
Hey, thanks for these posts. But I have tried all that was suggested and I still can't get any of my directory listings to show up in color. I have just had to create a .bashrc file where none existed, but is there a global one I can use? I'm using Gentoo. thx.
 
Old 01-02-2005, 02:50 PM   #8
Tim Retout
LQ Newbie
 
Registered: Dec 2004
Location: UK
Distribution: Debian
Posts: 21

Rep: Reputation: 15
Are you adding the '--color' flag to ls? Silly question... Else it'll be to do with the terminal you're using. Anyway, make sure something like this is somewhere in your .bashrc:

Code:
alias ls='ls --color=auto'
LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:';
export LS_COLORS
That LS_COLORS is all one line, btw.
 
Old 01-02-2005, 02:51 PM   #9
Tim Retout
LQ Newbie
 
Registered: Dec 2004
Location: UK
Distribution: Debian
Posts: 21

Rep: Reputation: 15
Of course, if you've got dircolors installed, then it's just a case of
Code:
eval `dircolors -b`
instead of the last two lines.
 
Old 01-02-2005, 03:22 PM   #10
jules_fraser
Member
 
Registered: Nov 2003
Location: London, UK
Distribution: Gentoo, RH (and, yes: M$2k)
Posts: 77

Rep: Reputation: 15
Thanks, but it got sorted in the end. I didn't have a .bash_profile file which I have now included. All ok.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
slack 9.1 - confused term colors taopunk Slackware 0 04-05-2004 09:18 AM
remux help(term?) shanenin Linux - Software 0 04-02-2004 06:02 PM
x term Gordon Linux - General 1 03-26-2003 10:44 PM
term in Vi NSKL Linux - Software 19 12-04-2002 01:29 AM
term colors ?? xlord Linux - General 3 10-12-2002 12:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration