Adjustment the PS1 shade based upon the history shade?
As much as I recognize, there's no other way to quiz the colors of the terminal emulator. You can transform them with \e]4;NUMBER;#RRGGBB\a
(where NUMBER
is the terminal shade number (0-- 7 for light colors, 8-- 15 for intense colors) and also #RRGGBB
is a hexadecimal RGB shade value) if your terminal assistances that series (reference : ctlseqs).
Effective color pattern devices usually have a dark or light history establishing that you have to provide to show whether you have a black or dark grey history, or a white or light grey history.
When you're setting up on your own, it's generally adequate to determine you'll constantly make use of the very same history shade.
If you are making use of gnome - terminal you can get the history shade for any kind of account, in this instance for the Default account as
$ gconftool-2 --get /apps/gnome-terminal/profiles/Default/background_color
#E12FE12FC74D
after that you can determine just how to set your prompt as necessary.
Related questions