how to change the color of the terminal

6,818

Solution 1

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

Solution 2

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:
6,818

Related videos on Youtube

fixer1234
Author by

fixer1234

Updated on September 17, 2022

Comments

  • fixer1234
    fixer1234 over 1 year

    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.

    • Paul Tomblin
      Paul Tomblin over 14 years
      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.
    • Rafael Godinho Brandão
      Rafael Godinho Brandão over 14 years
      What terminal application are you using? It's different for different terminals.
    • Admin
      Admin over 14 years
      thanks for your replies.I forget to say that I'm using the server version CentOS.
    • Dennis Williamson
      Dennis Williamson over 14 years
      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.