I'm trying to set the background color of a terminal to black or something dark. I understand that usually this can be set by some argument like "-bg black". But each terminal has different syntax. I wonder if there is a more "universal" way to set this for any terminals.
For example I learned bash prompt can be set to specific color by customizing the PS1 variable like this, which works on any terminals:
# invert foreground and background color
PS1="\[$(tput rev)\]$PS1\[$(tput sgr0)\]"
# set foreground to red
PS1="\[$(tput setaf 1)\]$PS1\[$(tput sgr0)\]"
But that only alter the background color for the prompt. I tried remove the reset-color-to-default part (\[$(tput sgr0)\]
), then I got mixed color on the screen which looks horrible.
I also tried "setterm -background black", and it seems doesn't work on any terminals: gnome-terminal, konsole, yakuake, build-in-terminal in krusader. I'm running Ubuntu 8.04.1
So... is there a way to set this automatically for any terminal? Maybe some "magic lines" I can put into a *rc file?
Thanks for looking at my first post here