I learned that I can change the format of PS1, especially the color of the string. Then, is it possible to change the color based on the background color of the shell? Or, how can I detect the background color of the shell?
|
As far as I know, there's no way to query the colors of the terminal emulator. You can change them with Powerful color scheme mechanisms often have a dark or light background setting that you must supply to indicate whether you have a black or dark gray background, or a white or light gray background. When you're configuring for yourself, it's usually enough to decide you'll always use the same background color. |
|||||
|
|
With xterm, you can query the background color with the
|
|||
|
|
|
If you are using gnome-terminal you can get the background color for any profile, in this case for the Default profile as
then you can decide how to set your prompt accordingly. |
|||
|
|
