You are not logged in.

#1 2010-10-07 21:38:59

thms
Member
Registered: 2010-02-01
Posts: 120

[solved] ls: changing background color for folders

Is it possible to change the background for some folders in the ls output. The current makes them hard to read under some circumstances. I already tried different Xdefaults colors but all of them had that style of output.

ls

Last edited by thms (2010-10-08 12:02:00)

Offline

#2 2010-10-07 21:56:10

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [solved] ls: changing background color for folders

Sure you can do it via .dircolors -- you can find an example of such a file in my github dotfiles repo via my sign. If you're unfamiliar you may want to read up on ANSI color codes.

Offline

#3 2010-10-08 01:35:33

jdarnold
Member
From: Medford MA USA
Registered: 2009-12-15
Posts: 485
Website

Re: [solved] ls: changing background color for folders

'man dircolors' for more information on it.

Offline

#4 2010-10-08 07:42:19

thms
Member
Registered: 2010-02-01
Posts: 120

Re: [solved] ls: changing background color for folders

Thanks falconindy.

I have some nice results with your .dircolors but these special folders still look the same.

For what I see in your file there is an entry for DIR but this seems affect "normal" directories only. The directories with the green background are mounted under another filesystem (not synced when using rsync -x). Is there a special variable for them? The man page is very short on informations.

Offline

#5 2010-10-08 08:37:07

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: [solved] ls: changing background color for folders

There are several things that can make directories another color: sticky bit and other writeable, stickybit and not other writeable, other writeable and not sticky, and probably some more I've forgotten. Try my LS_COLORS (assuming you use 256 colors):

*.textile=38;5;106:ln=target:*.hs=38;5;159:*.ini=38;5;122:*.part=38;5;240:*.pid=38;5;160:*.pod=38;5;106:*.vim=1:*.git=38;5;197:*.urlview=38;5;85:*.dump=38;5;119:*.conf=1:*.md=38;5;184:*.markdown=38;5;184:*.h=38;5;81:*.rb=38;5;192:*.c=38;5;110:*.diff=42;38:*.yml=38;5;208:*.PL=38;5;160:*.csv=38;5;78:tw=33;1;38;5;208:*.chm=38;5;144:*.bin=38;5;249:*.sms=38;5;33:*.pdf=38;5;203:*.cbz=38;5;140:*.cbr=38;5;140:*.nes=38;5;160:*.mpg=38;5;38:*.ts=38;5;39:*.sfv=38;5;197:*.m3u=38;5;172:*.txt=38;5;192:*.log=38;5;190:*.bash=38;5;173:*.swp=38;5;241:*.swo=38;5;236:*.theme=38;5;109:*.zsh=38;5;173:*.nfo=38;5;220:mi=38;5;124:or=38;5;160:ex=33;1;38;5;148:ln=target:pi=38;5;126:ow=33;1;38;5;208:di=38;5;30:*.pm=33;1;38;5;197:*.pl=38;5;214:*.sh=38;5;113:*.patch=45;37:*.tar=38;5;118:*.tar.gz=38;5;119:*.zip=38;5;11:*.rar=38;5;160:*.tgz=38;5;11:*.7z=38;5;11:*.mp3=38;5;191:*.flac=33;1;38;5;166:*.mkv=33;1;38;5;115:*.avi=38;5;114:*.wmv=38;5;113:*.jpg=38;5;66:*.JPG=38;5;66:*.jpeg=38;5;67:*.png=38;5;68:*.pacnew=38;5;33:*.xz=38;5;118:*.iso=38;5;124:*.css=38;5;91:*.php=38;5;93:*.gitignore=38;5;240:*.tmp=38;5;244:*.py=38;5;41:*.rmvb=38;5;112:*.arj=38;5;11:*.a=38;5;59:*.a00=38;5;11:*.A64=38;5;82:*.pc=38;5;100:*.a52=38;5;112:*.gel=38;5;83:*.ggl=38;5;83:*.directory=38;5;83:*.a78=38;5;112:*.atr=38;5;213:*.j64=38;5;102:st=1;38;5;208:*.st=38;5;208:*.dat=38;5;165:*.db=38;5;60:*.xml=38;5;23:*.cdi=38;5;124:*.nrg=38;5;124:*.32x=38;5;137:*.gg=38;5;138:*.cue=38;5;112:*.adf=38;5;35:*.nds=38;5;193:*.gb=38;5;203:*.gbc=38;5;204:*.gba=38;5;205:*.sav=38;5;220:*.r00=38;5;233:*.r01=38;5;234:*.r02=38;5;235:*.r03=38;5;236:*.r04=38;5;237:*.r05=38;5;238:*.r06=38;5;239:*.r07=38;5;240:*.r08=38;5;241:*.r09=38;5;242:*.r10=38;5;243:*.r11=38;5;244:*.r12=38;5;245:*.r13=38;5;246:*.r14=38;5;247:*.r15=38;5;248:*.r16=38;5;249:*.r17=38;5;250:*.r18=38;5;251:*.r19=38;5;252:*.r20=38;5;253:*.r21=38;5;254:*.r22=38;5;255:*.r47=38;5;255:*.r47=38;5;233:*.r46=38;5;234:*.r45=38;5;235:*.r44=38;5;236:*.r43=38;5;237:*.r42=38;5;238:*.r41=38;5;239:*.r40=38;5;240:*.r39=38;5;241:*.r38=38;5;242:*.r37=38;5;243:*.r36=38;5;244:*.r35=38;5;245:*.r34=38;5;246:*.r33=38;5;247:*.r32=38;5;248:*.r31=38;5;249:*.r30=38;5;250:*.r29=38;5;251:*.r28=38;5;252:*.r27=38;5;253:*.r26=38;5;254:*.r25=38;5;255:*.json=38;5;199:*.SKIP=38;5;244:*.1p=38;5;160:*.3p=38;5;160

I (ab)use them for things like "mark them TV shows I've seen", like this:


-- mod edit: read the Forum Etiquette and only post thumbnails http://wiki.archlinux.org/index.php/For … s_and_Code --


Also, see http://github.com/trapd00r/configs/blob … colors.zsh

Last edited by dmz (2010-10-08 08:40:12)

Offline

#6 2010-10-08 11:17:03

thms
Member
Registered: 2010-02-01
Posts: 120

Re: [solved] ls: changing background color for folders

Thanks dmz,

with your colors everything is readable (and it looks very nice smile )

Is there a difference if I use your line in my .bashrc or if I use a separate .dircolors like falconindy?

Offline

#7 2010-10-08 11:51:11

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: [solved] ls: changing background color for folders

Yes, doing it my way will give you a lot more girlfriends.

Offline

#8 2010-10-08 12:01:43

thms
Member
Registered: 2010-02-01
Posts: 120

Re: [solved] ls: changing background color for folders

This is what I wanted to hear...

...you made my day smile

Offline

#9 2010-10-08 14:30:19

thms
Member
Registered: 2010-02-01
Posts: 120

Re: [solved] ls: changing background color for folders

dmz...I looked through your github repo because I hoped you're using some nice colors in your terminal for other things, too. I saw your .Xresources and now I'm a bit confused. What are the urxvt.shiva and india things?

Offline

#10 2010-10-08 14:46:40

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: [solved] ls: changing background color for folders

shiva and india are two of my machines. I start urxvt with urxvt -name URxvt.india on the india box, for example.

Offline

Board footer

Powered by FluxBB