Basic FVWM Configuration
The color designated by the entry #8a4510 (which, for the curious, happens to be SaddleBrown) is in hexadecimal notation. As of X11 Release 5, there are several means for specifying color: two commonly used formats are RGB color names (such as SaddleBrown) and RGB hexadecimal values (such as #8a4510). The acronym RGB stands for “Red, Green, Blue” and has to do with how colors are generated.
Recall from your school days that all colors can be produced by a combination of primary colors—cyan, magenta, and yellow. Technically speaking, these are the “subtractive” primary colors of paint; when you put them all together, they subtract all the light and make “black” (it really turns out brown). It is also possible to create colors using a combination of red, green, and blue “additive” primary colors of light—when you put them all together, they add up to make white. Hence, the RGB designation indicates the amount each of red, green, and blue light which make up a color. To see what colors are available to you under X, you can view the file /usr/lib/X11/rgb.txt. This file contains a listing of all of the named colors on your system. This might contain a listing such as:
... 139 69 19 saddle brown 139 69 19 SaddleBrown 160 82 45 sienna 205 133 63 peru 222 184 135 burlywood 245 245 220 beige 245 222 179 wheat ...
Each line contains the color name and three columns of numbers which represent the relative contribution of red, green, and blue values based on a scale from 0-255—the range of numbers that can be stored in 8 bits, or one byte. Pretty clever, eh? For reference sake, white contains the maximum value of red, green, and blue and has a value of 255, 255, 255. Black is defined as 0, 0, 0. This still doesn't answer the question of what #8a4510 looks like, until you know a bit about hexadecimal.
The hexadecimal system uses a base 16 place order system with “digits” including the numbers 0-9 and the letters a-f (representing decimal values 10-16). Knowing that an RGB designation must have an entry for each of the base colors, you can quickly surmise that by breaking 8a4510 into three hexadecimal numbers and converting them to decimal, that you could find their value in the rgb.txt file above (which uses decimal values for the red, green, and blue values). Converting from hex to decimal by hand isn't very difficult, but here's an even easier way to do it:
Enter bc at the command line to start the bc online calculator, and enter:
This sets the input to base 16 (hexadecimal). Now, enter the numbers that you want to convert to decimal separated by a semicolon:
You must use capital letters for hexadecimal input. The output should look something like:
138 69 16
Do ctrl-D or type quit to exit bc.
Thus, the red value is 138, green is 69, and blue is 16. Going back to the sample rgb.txt entry above, we can see that this is very close to the entry for SaddleBrown (the blue value in rgb.txt is 19 instead of 16) and this is, in fact, what our color turns out to be.
Now, if all of this seems needlessly complex, rest assured that there are easier ways of viewing and handling colors under X. There are a few must-have configuration utilities that make using and customizing X-Windows a lot easier, and a color viewer such as xcolorsel is one of these. You should be able to find a copy of this very useful program at sunsite.unc.edu (or preferably one of the mirror sites) in the /pub/Linux/X11/xutils/colors/ directory. This very handy program:
1. Shows a color patch and the rgb.txt entry for each color.
2. Displays the color entry in any of 16 different formats, including the hexadecimal notation we've just looked at.
3. Lets the user “grab” a color off the desktop and displays the rgb entry that most closely matches it.
4. Lets the user “preview” what a certain foreground/background color combination might look like using its Set foreground and Set background features.
When you start up xcolorsel, you are initially presented with a display window containing color patches, their corresponding rgb values in decimal notation, and the color name—just as they appear in the rgb.txt file. Clicking on the Display format button presents you with a menu of different formats—choosing 8 bit truncated rgb from this menu lets you view SaddleBrown with its rgb hex value of #8a4510! So, now you can easily see what each color name looks like and, if you're curious, what the hexadecimal notation would be. Thus, the following entries are equivalent:
StdForeColor SaddleBrown StdForeColor saddle brown StdForeColor #8a4510
Keep in mind that hexadecimal notation requires the pound, or hash sign (# ) prefix.
Use the Grab color feature to quickly find out what a color's rgb entry is. To do this click on the Grab color button—the cursor will change to a small magnifying glass. Then, position the cursor over any color on your desktop and click once; xcolorsel will display along the bottom status line how many matches or near-matches there are and will highlight the closest entry in the color display window.
Finally, if you want to see what a particular foreground/background color combination might look like, try this: using the mouse pointer, highlight a color you want to use as either the foreground or background color and then hit either the Set foreground or Set background buttons at the bottom. The foreground or background colors of the color display window will then be changed to this value. Hitting the Default colors button reverts the window to its original color scheme.
Now that you've got a bit of a feel for how colors are defined, you can easily create your own customized “window treatments”. However, if you've made changes, started up fvwm, and things still aren't quite the way you'd expected, there still a couple more things you need to know about...
- October 2014 Issue of Linux Journal: Embedded
- Encrypt Your Dog (Mutt and GPG)
- Practical Tiny Core in the Fire Service
- DevOps for Dummies
- Tech Tip: Really Simple HTTP Server with Python
- Python Scripts as a Replacement for Bash Utility Scripts
- New Products
- RSS Feeds
- Open Axiom
- Returning Values from Bash Functions
Free DevOps eBooks, Videos, and more!
Regardless of where you are in your DevOps process, Linux Journal can help!
We offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, and advice & help from the expert sources like:
- Linux Journal