terminal icon indicating copy to clipboard operation
terminal copied to clipboard

text color use for normal user and root user

Open elementaryBot opened this issue 8 years ago • 2 comments

from the question section: https://answers.launchpad.net/pantheon-terminal/+question/274025

give the terminals which are logged on in root user change the text color (red is suggested by the question) This can also be extended to when there is "sudo " present in the text to change it to a color.

The question also states that normal terminals text also should get a color (green is suggested by the question) to have the good and bad difference visible.

Launchpad Details: #LP1516353 kay van der Zander - 2015-11-15 09:12:07 +0000

elementaryBot avatar Apr 26 '17 16:04 elementaryBot

#The approach I use moves to .bashrc the following for normal terminals: force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # We have color support; assume it's compliant with Ecma-48 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such # a case would tend to support setf rather than setaf.) color_prompt=yes else color_prompt= fi fi

if [ "$color_prompt" = yes ]; then PS1="[[\e[0;32m]\d[\e[0m] - [\e[3;32m]\A[\e[0m]] [\e[1;32m]\u[\e[0m]@[\e[1;33m]\h[\e[0m][\e[1;35m]:[\e[0m][\e[1;34m]\w[\e[0m]$ "

PS1='${debian_chroot:+($debian_chroot)}[\033[01;32m]\u@\h[\033[00m]:[\033[01;34m]\w[\033[00m]$ '

else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$ ' fi unset color_prompt force_color_prompt

Launchpad Details: #LPC Félix Brezo - 2016-03-25 07:08:26 +0000

elementaryBot avatar Apr 26 '17 16:04 elementaryBot

#Similarly, i already use a red color for the terminals started by root

uncomment for a colored prompt, if the terminal has the capability; turned

off by default to not distract the user: the focus in a terminal window

should be on the output of commands, not on the prompt

force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # We have color support; assume it's compliant with Ecma-48 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such # a case would tend to support setf rather than setaf.) color_prompt=yes else color_prompt= fi fi

if [ "$color_prompt" = yes ]; then PS1="[[\e[0;33m]\d[\e[0m] - [\e[3;33m]\A[\e[0m]] [\e[1;31m]\u[\e[0m]@[\e[1;33m]\h[\e[0m][\e[1;35m]:[\e[0m][\e[1;34m]\w[\e[0m]$ " else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$ ' fi unset color_prompt force_color_prompt

Launchpad Details: #LPC Félix Brezo - 2016-03-25 07:11:45 +0000

elementaryBot avatar Apr 26 '17 16:04 elementaryBot