LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-16-2014, 04:38 PM   #1
Special K
LQ Newbie
 
Registered: Aug 2013
Posts: 5

Rep: Reputation: Disabled
relationship between .dir_colors settings and XTerm*color# settings


I am currently running the xfce window manager on top of RHEL5. I alternate between using Konsole and xterm as my terminals.

I have set my ~/.dir_colors file to customize the display of files and folders when I use the ls command. I have specified that .log files should be displayed in a light gray color. Everything appears as expected when I run "ls" in a Konsole.

If I run "ls" in an xterm, which I have configured to use a black background, .log files are invisible because for some reason they are being displayed with a black foreground, which of course is not visible on top of a black background.

After some trial and error, I found that if I add the following line to my ~/.Xdefaults file:

XTerm*color0: #BEBEBE

.log files correctly display as light gray in xterm when using the ls command, consistent with the behavior of ls in Konsole.

What is the relationship between the color codes used in the .dir_colors file and the XTerm*color# variables used in the .Xdefaults file?
 
Old 05-22-2014, 01:02 AM   #2
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
What is the relationship between the color codes used in the .dir_colors file and the XTerm*color# variables used in the .Xdefaults file?
Code:
 info coreutils 'dircolors'
Dircolors manipulates the values in the the dircolors database:
Code:
 dircolors --print-database
Or, if referenced as a file, it sets the shell environmental variable $LS_COLORS

.Xdefaults is an X server resource,

Last edited by dijetlo; 05-22-2014 at 02:43 AM. Reason: talking before researching....
 
Old 05-22-2014, 11:13 PM   #3
Special K
LQ Newbie
 
Registered: Aug 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
That's not quite what I'm asking. In my .dir_colors file, I have specified that .log files should appear as light gray. When I run "ls" in an xterm, the .log files are actually displayed in black text, which is invisible on a black background. If I add the following line to my ~/.Xdefaults file:

XTerm*color0: #BEBEBE

.log files correctly display as light gray in xterm when using the ls command.

How am I supposed to know which XTerm*color# variables correspond to which colors specified in the .dir_colors file?
 
Old 05-23-2014, 10:22 AM   #4
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
That's not quite what I'm asking.
I understand K, but I think you're probably doing this the hard way. Additionally I have no idea how much green you need to add to the blue to make gray, I can't see it and in truth, I'm color blind, so I'm hardly the guy to ask about that.
Let me explain what I think is happening. $LS_COLOR (via the Dircolors db) has a color it's trying to paint default files. Since we've never made a "log" file a special file group, for $LS_COLOR it's just a default or normal file (therefor color). Don't assume "black" means a lack of color, it doesn't, $LS_COLOR picked "black" from a lot of different values.
xdefaults, which appears to be deprecated (check your distro) is trying to paint it another color. It would be easier to do this if they'd stop arguing, wouldn't it?
Now you can disable .xdefaults attempts to paint the terminal, just remove the appropriate lines in the ~/.xdefaults directory, but you're not going to be able to stop $LS_COLOR from doing it's job, even if you empty the values in the hash table, there's a default color stored in the system, it'll just go with what it knows.
If you look at info coreutils 'dircolor' it will tell you that the $LS_COLOR local hash table (your ~/.dircolors file) is only going to be read it you put a little script that evaluates it in your ~/.bashrc directory. So do that.
The next step is to disable .xdefaults attempts to re-write what $LS_COLOR has already written and you should have total, fine grain control over every file type that interests you via the $LS_COLOR variable at the database level which will give you a stable, fully functional fix as long as $LS_COLOR remains in your disto.

Last edited by dijetlo; 05-23-2014 at 10:47 AM.
 
Old 05-23-2014, 10:26 AM   #5
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
The script from info coreutils 'dircolors'

Code:
#!/bin/bash
d=.dircolors
test -r $d && eval"$(dircolors $d)"
You can run that script manually as well to reload the dircolors db and repopulate the $LS_COLOR variable so when you make changes it's easy to test.

Last edited by dijetlo; 05-23-2014 at 10:27 AM.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Change My Color Settings afaucett Linux - Newbie 1 06-23-2011 12:41 PM
Desktop environment color settings: do they affect web browser color? stf92 Linux - Newbie 2 06-14-2011 03:17 PM
mplayer color settings ringo1 Linux - Desktop 1 11-14-2006 07:42 AM
KDE browser color settings csDraco_ Slackware 1 03-27-2006 01:29 AM
xterm settings alaios Linux - General 3 11-20-2004 07:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:30 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