Search:  
Gentoo Wiki

TIP_Linux_Colors_in_Aterm/rxvt

This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

Contents

Introduction

Do you like nice easy-on-the-eyes colors from the Command Line? The aterm default colors just aren't the best for easy viewing. Here are a few ways to lessen the stress on your eyes.

Locally

This method only involves modifying your .Xdefaults file. Many X applications will read configuration data from the ~/.Xdefaults file, including terminal emulators such as XTerm and ATerm. The format of .Xdefaults is:

app*resource: value

For XTerm and ATerm, app is simply their respective names. Note, however, that ATerm will inherit any resources from XTerm that have the same name and are not explicitly overwritten. Therefore, it is preferable to use XTerm for app, which sets both ATerm and XTerm at the same time.


So, simply open your .Xdefaults and add the following lines:

File: ~/.Xdefaults
XTerm*background:    0   0   0
XTerm*foreground:  168 168 168
XTerm*color0:        0   0   0
XTerm*color1:      168   0   0
XTerm*color2:        0 168   0
XTerm*color3:      168  84   0
XTerm*color4:        0   0 168
XTerm*color5:      168   0 168
XTerm*color6:        0 168 168
XTerm*color7:      168 168 168
XTerm*color8:       84  80  84
XTerm*color9:      248  84  80
XTerm*color10:      80 252  80
XTerm*color11:     242 252  80
XTerm*color12:      80  84 248
XTerm*color13:     248  84 248
XTerm*color14:      80 252 248
XTerm*color15:     248 252 248

For any of the colors, you can also use hexadecimal notation; simply prepend the hex color with a pound (#). So, the first line above would become XTerm*background: #000000.

Localized Global

Step 1: Adding colors to rgb.txt

This is one of the easiest parts. You must be root to perform this step.

First, we start nano with rgb.txt open, and go to the end (the file is 755 lines long so 760 goes to the end) then, add this to the bottom:

File: /usr/share/X11/rgb.txt
  0   0   0         console_black
 84  80  84         console_bright_black
168   0   0         console_red
248  84  80         console_bright_red
  0 168   0         console_green
 80 252  80         console_bright_green
168  84   0         console_yellow
242 252  80         console_bright_yellow
  0   0 168         console_blue
80   84 248         console_bright_blue
168   0 168         console_magenta
248  84 248         console_bright_magenta
  0 168 168         console_cyan
 80 252 248         console_bright_cyan
168 168 168         console_white
248 252 248         console_bright_white

Step 2: Editing ~/.Xdefaults file

Most X-Based terminals read the per-user configuration file in ~/.Xdefaults. In this file defaults for applications are specified with the syntax:

app*resource: value

Aterm's is aterm, Xterm is XTerm, and so on - Read the man page for your favorite. In these examples I'll use aterm. You need to change xterm to aterm or whatever your favorite term specifies.

I'll go straight to the colors - here's what you need in that file:

File: ~/.Xdefaults
aterm*background: console_black
aterm*foreground: console_white
aterm*color0:  console_black
aterm*color1:  console_red
aterm*color2:  console_green
aterm*color3:  console_yellow
aterm*color4:  console_blue
aterm*color5:  console_magenta
aterm*color6:  console_cyan
aterm*color7:  console_white
aterm*color8:  console_bright_black
aterm*color9:  console_bright_red
aterm*color10: console_bright_green
aterm*color11: console_bright_yellow
aterm*color12: console_bright_blue
aterm*color13: console_bright_magenta
aterm*color14: console_bright_cyan
aterm*color15: console_bright_white

Globally

X will apply settings per application to all users based on the files in /etc/X11/app-defaults. See the files XTerm and XTerm-color, which can be edited in the same method as described in the above examples. An ATerm file could also be added. These files will be overridden by settings in ~/.Xdefaults.

Some considerations

Xterm, rxvt and aterm (and most others) by default make the bright versions of the colors appear as bold. This can be overcome by adding your favorite font into the ~/.Xdefaults file as both normal font and bold font:

File: ~/.Xdefaults
 aterm*font:-nil-profont-medium-r-normal--11-110-72-72-c-60-iso8859-1
 aterm*boldFont:-nil-profont-medium-r-normal--11-110-72-72-c-60-iso8859-1

Note: You can use xfontsel to find a font in the form above.

You should also specify a different color for bold text if you use the same font for both:

File: ~/.Xdefaults
 aterm*colorBD: console_bright_white

The colors listed in the instructions above may still seem harsh to someone who stares at terminal windows a lot. If that describes you, you may wish to use even gentler colors. The example .Xdefaults below provides such colors:

File: ~/.Xdefaults
XTerm*background:  #000000
XTerm*foreground:  #7f7f7f
XTerm*color0:      #000000
XTerm*color1:      #9e1828
XTerm*color2:      #aece92
XTerm*color3:      #968a38
XTerm*color4:      #414171
XTerm*color5:      #963c59
XTerm*color6:      #418179
XTerm*color7:      #bebebe
XTerm*color8:      #666666
XTerm*color9:      #cf6171
XTerm*color10:     #c5f779
XTerm*color11:     #fff796
XTerm*color12:     #4186be
XTerm*color13:     #cf9ebe
XTerm*color14:     #71bebe
XTerm*color15:     #ffffff

Below is a table to demonstrate the difference between the two color schemes (both color sets look brighter against a black terminal window):

Colors originally suggested:                                                
Colors listed above:                                                

That about does it, to enjoy the beautiful color reload the new configuration with:

 xrdb -load ~/.Xdefaults

See also

http://mkaz.com/ref/xterm_colors.html

Gentoo forum thread, with howto transparency, eye candy, etc. http://forums.gentoo.org/viewtopic.php?t=68555

Discuss

Concerns or Compliments? Please use the Discussion section.

Retrieved from "http://www.gentoo-wiki.info/TIP_Linux_Colors_in_Aterm/rxvt"

Last modified: Fri, 05 Sep 2008 10:00:00 +0000 Hits: 37,145