Terminal emulator's prompt (user@machine) not colored

Hi,

After years of wanting to switch off of Manjaro KDE, I installed dual-boot Endeavour OS (Gnome) yesterday along with Win10, and I am absolutely loving the distro so far.

One minor issue I’m having is that the prompt of user@machine, which is jlee@x1c6 in my case, is not green, like I see in screenshots and videos I’ve seen of other users’ screens, and is the same white color as the inputted commands. This happens REGARDLESS of the terminal emulator or DE I’m using. How can I fix this?

The above shows no colors on the prompt on three different terminal emulators:

  • GNOME Console
  • GNOME Terminal
  • Konsole

I also tested it on the Cinammon and KDE Plasma DE, and they are also the same.

You can also see that colors render fine for any of the responses, but it seems to just the prompt that is affected.

I’ve referred to these posts so far:

  1. AskUbuntu - How do I get a colored bash?
  2. AskUbuntu - Terminal has lost its colours

Based on the above posts, I tried adding color_prompt=yes and force_color_prompt=yes (separately), which both had no effect. I also ran cp /etc/skel/.bashrc ~/, but that didn’t change anything either.

I assume that Grufo/Color System’s Bash Prompt would be a great place to refer to, but I didn’t want to make drastic changes on my bash files or environment variables yet.

For reference, here is the contents of my ~/.bashrc file:

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

[[ -f ~/.welcome_screen ]] && . ~/.welcome_screen

_set_liveuser_PS1() {
    PS1='[\u@\h \W]\$ '
    if [ "$(whoami)" = "liveuser" ] ; then
        local iso_version="$(grep ^VERSION= /usr/lib/endeavouros-release 2>/dev/null | cut -d '=' -f 2)"
        if [ -n "$iso_version" ] ; then
            local prefix="eos-"
            local iso_info="$prefix$iso_version"
            PS1="[\u@$iso_info \W]\$ "
        fi
    fi
}
_set_liveuser_PS1
unset -f _set_liveuser_PS1

ShowInstallerIsoInfo() {
    local file=/usr/lib/endeavouros-release
    if [ -r $file ] ; then
        cat $file
    else
        echo "Sorry, installer ISO info is not available." >&2
    fi
}


alias ls='ls --color=auto'
alias ll='ls -lav --ignore=..'   # show long listing of all except ".."
alias l='ls -lav --ignore=.?*'   # show long listing but no hidden dotfiles except "."

[[ "$(whoami)" = "root" ]] && return

[[ -z "$FUNCNEST" ]] && export FUNCNEST=100          # limits recursive functions, see 'man bash'

## Use the up and down arrow keys for finding a command in history
## (you can write some initial letters of the command first).
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'

################################################################################
## Some generally useful functions.
## Consider uncommenting aliases below to start using these functions.
##
## October 2021: removed many obsolete functions. If you still need them, please look at
## https://github.com/EndeavourOS-archive/EndeavourOS-archiso/raw/master/airootfs/etc/skel/.bashrc

_open_files_for_editing() {
    # Open any given document file(s) for editing (or just viewing).
    # Note1:
    #    - Do not use for executable files!
    # Note2:
    #    - Uses 'mime' bindings, so you may need to use
    #      e.g. a file manager to make proper file bindings.

    if [ -x /usr/bin/exo-open ] ; then
        echo "exo-open $@" >&2
        setsid exo-open "$@" >& /dev/null
        return
    fi
    if [ -x /usr/bin/xdg-open ] ; then
        for file in "$@" ; do
            echo "xdg-open $file" >&2
            setsid xdg-open "$file" >& /dev/null
        done
        return
    fi

    echo "$FUNCNAME: package 'xdg-utils' or 'exo' is required." >&2
}

#------------------------------------------------------------

## Aliases for the functions above.
## Uncomment an alias if you want to use it.
##

# alias ef='_open_files_for_editing'     # 'ef' opens given file(s) for editing
# alias pacdiff=eos-pacdiff
################################################################################

Thank you in advance.

In GNOME-Terminal go to settings > profile > colour to change the colour-pattern.

In GNOME-Terminal go to settings > profile > colour to change the colour-pattern.

Thank you for the help, but this unfortunately does not solve the issue, unless there’s an option that I haven’t ticked:

It also isn’t GNOME-Terminal-specific, as it affects GNOME-Console, Konsole, Xfce Terminal, and UXTerm - all my terminal emulators are impacted, system-wide.

Not a big deal that it’s not colored, but I would like to be able to visually differentiate between my inputs and the user@machine prompt.

Don’t know if it matters, but I am using the Nordic-darker-v40 theme:

Hello @headfirst7231
I just reinstalled Endeavor a few days ago, and had the same issue.
After some research I decided to use ZSH shell and the powerlevel10k theme for it because of many advantages it offers, and convenient plugins for ZSH, but I considered using just starship prompt.
Globally changing shell, or just prompt, will/should affect every terminal emulator.

PS
One more thing, if You run “ls --color=auto” it will colorize the output, you can easily make an alias for it, I did it in my ZSH config file “~/.zshrc”

alias ls='ls --color=auto'

I don’t use a DE so I can’t give you steps but here is an observation

in the first picture you display you have a checkbox next to Use colors from system theme
what happens if you remove that and set the colors yourself?

I ask because if it can display the colors you chose then maybe the theme has a compatibility issue with your particular setup

Solved my own issue, and the bash prompt is now colored:

The bash not being colored was because there was no formatting applied to the PS1 settings in my original ~/.bashrc file. I commented out the unformatted PS1 and pasted it with the bash generated from https://ezprompt.net/.

Not fully happy with the color yet (want it to be lighter and more visible), but I’m happy I at least know why this is happening and how to fix it.

Thank you for everyone who helped with the issue.

1 Like

This is similar to what I was thinking of but I cannot remember which site I used

Update: I referred to a bash color cheat sheet to simplify the syntax of the bash prompt and update the color to a more visible green:

The final change I made to ~/.bashrc was to comment out the original line where PS1 was defined, and to add PS1='\033[32m\u@\h \W \$ \033[0m\]', which is a lot simpler and gets the job done for me.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.