You are not logged in.
okay so i wanted to change the color of the "beginning of a bash line" (default: "[stefan@arch ~]$ "; don't know how it's called has the PS1 value^^) differently.
I wanted to change it to #07b. Now i didn't find anything which can do this.
I tried it via:
tput setaf [...]
but that didn't really work and I didn't find anything to input an hex value (rgb would work as well).
Is this possible, if yes how?
Last edited by Stefan_xyz (2019-09-01 20:35:52)
Offline
does the terminal in use support such color ? which one is it ?
it has to be able to handle 256 colors.
however to change colors from bash, you have to convert from HEX to terminal control sequence; it's not RGB either, it's got something to do with ANSI...
Offline
does the terminal in use support such color ? which one is it ?
it has to be able to handle 256 colors.
I using the xfce4-terminal. It should be able to handle 256 colors
however to change colors from bash, you have to convert from HEX to terminal control sequence; it's not RGB either, it's got something to do with ANSI...
hmm i understand... do you know a tool to convert hex to ANSI?
Offline
Read these two links:
https://misc.flogisoft.com/bash/tip_col … formatting
https://jonasjacek.github.io/colors/
They should explain everything you need to properly setup your colors.
Example for a pure red line where your commands and output are white:
export PS1='\e[31m[\u@\h \W]\$\e[37m 'Offline
Read these two links:
https://misc.flogisoft.com/bash/tip_col … formatting
https://jonasjacek.github.io/colors/They should explain everything you need to properly setup your colors.
Example for a pure red line where your commands and output are white:
export PS1='\e[31m[\u@\h \W]\$\e[37m '
Okay thanks. Doesn't work what i wanted but i chose cyan since it's the closest to it.
Offline
You can configure what "cyan" is in hex code in your terminal emulator configs (to be even something not remotely close to cyan if you so chose). Or in the tty you can use setvtrgb to to set 24bit colors to each of the 16 terminal colors.
But none of this has anything to do with bash, or any other shell, as shells don't know anything about color. This is entirely up to the terminal (emulator).
Last edited by Trilby (2019-09-01 21:05:43)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I noticed you marked it as solved, but you can update the color palette if you really want to.
#replace color cyan1 (index 51) with your desired color
echo -en "\e]4;51;#07b\e\\"
#print test line
echo -e "\e[38;5;51mtest"
#to reset it back run
#echo -en "\e]4;9;cyan1\e\\"
#notice it changes everything printed before as wellMaybe that's closer to what you wanted or expected.
Offline