Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using CentOS 4.8. I like the grey background color and the black foreground color,by which my eyes wouldn't sore.

when I set 'export PS1="\e[0;30m\e[47m\u@\h \w>"' , It only changes the bash prompt line colors.

When I'm editing text via 'vi' or looking up information via 'info',the colors are back to default.

So I'm wondering how to change the background and foreground color globally. thanks for any tip.

updates:

My CentOS is server version, so there is no gui interface.

share|improve this question

migrated from stackoverflow.com Dec 17 '09 at 4:04

This question came from our site for professional and enthusiast programmers.

    
In the old days, there were several hundred options you could set in your .Xdefaults to customize an xterm. Now it's probably in drop down menus or something boring like that. –  Paul Tomblin Dec 17 '09 at 2:56
    
What terminal application are you using? It's different for different terminals. –  ZoogieZork Dec 17 '09 at 2:57
    
thanks for your replies.I forget to say that I'm using the server version CentOS. –  Anonymous Dec 17 '09 at 3:08
3  
You don't say whether you're on the console, using xterm, using something like PuTTY, or if you're using Gnome or KDE and one of their terminals, etc. –  Dennis Williamson Dec 17 '09 at 3:59
add comment

2 Answers

The terminal color is set by a flag on the xterm command (if you're running X of course):

-bg color
This option specifies the color to use for the background of the window. The default is ''XtDefaultBackground.''

-fg color
This option specifies the color to use for displaying text. The default is ''XtDefaultForeground.''
-fn font
share|improve this answer
add comment

Gnome Terminal picks up the background colour from the profile in use, so any change will impact the background colour of all terminals using the same profile. The configuration key is stored in /apps/gnome-terminal/profiles/Default/background_color, where Default is the currently used profile. I have demonstrated it in below code.

  1. Open the file named %gconf.xml under */apps/gnome-terminal/profiles/Default
  2. Change the background and foreground colour accordingly.

     <?xml version="1.0"?>
      <gconf>
      <entry name="use_theme_colors" mtime="1401108737" type="bool" value="false"/>
      <entry name="visible_name" mtime="1401108737" type="string">
        <stringvalue>Default</stringvalue>
      </entry>
    <entry name="palette" mtime="1401108737" type="string">
        <stringvalue>#2E2E34343636:#CCCC00000000:#4E4E9A9A0606:#C4C4A0A00000:#34346565A4A4:#757550507B7B:#637AD089D262:#D3D3D7D7CFCF:#555557575353:#EFEF29292929:#8A8AE2E23434:#FCFCE9E94F4F:#72729F9FCFCF:#ADAD7F7FA8A8:#3434E2E2E2E2:#EEEEEEEEECEC</stringvalue>
    </entry>
    <entry name="background_color" mtime="1401108737" type="string">
        <stringvalue>#000000000000</stringvalue>
    </entry>
    <entry name="foreground_color" mtime="1401108737" type="string">
        <stringvalue>#FFFFFFFFFFFF</stringvalue>
    </entry>
    <entry name="bold_color" mtime="1401108737" type="string">
        <stringvalue>#000000000000</stringvalue>
    </entry>
    

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.