Announcement

Collapse
No announcement yet.

Konsole Kolors

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Konsole Kolors

    Not an important issue, but...I like the way Konsole now uses a green color for the prompt while keeping white or grey for the rest. However, I can't seem to do that. When I try to change the colors, everything changes. How can I get the prompt only to appear in green?

    #2
    Originally posted by oldgeek View Post
    Not an important issue, but...I like the way Konsole now uses a green color for the prompt while keeping white or grey for the rest. However, I can't seem to do that. When I try to change the colors, everything changes. How can I get the prompt only to appear in green?
    How are you trying to change the colors? [Settings] [Edit Current Profile] [Appearance] "Linux Colors."
    Attached Files
    If you think Education is expensive, try ignorance.

    The difference between genius and stupidity is genius has limits.

    Comment


      #3
      Yes, but I don't get what you posted, just a list of color schemes to choose. I'm currently using Breeze. How do I get the prompt to go green? By the way, my configuration if Konsole is probably 16.04 (I'm using 18.04) since I copied it directly from Aptik before I started using btrfs. Does that make any difference?

      Comment


        #4
        In the konsole, I like green text on a black background.

        Using the konsole Settings, then the Appearance tab, about half way to the bottom of choices select green on black. As a personal choice, I also up the text size to 11. Click OK to exit Settings
        Linux User #454271

        Comment


          #5
          Edit .bashrc (it's in your user /home directory). User your favorite editor.

          Find and then change to match the following section:

          Code:
          # set a fancy prompt (non-color, unless we know we "want" color)case "$TERM" in
              xterm-color|*-256color) color_prompt=yes;;
          esac
          
          
          # 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='${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
          If you have konsole running when you do this, you'll have to close it and launch it again for the change to take effect.
          Windows no longer obstructs my view.
          Using Kubuntu Linux since March 23, 2007.
          "It is a capital mistake to theorize before one has data." - Sherlock Holmes

          Comment


            #6
            My answer is essentially the same as snowhog's, but a bit more simplified and elucidated.

            First, choose your colour, or colours. To see the basic set of 16, run this in bash:
            Code:
            csi=$'\e['
            for n in $(seq 30 37);do echo -n "${csi}${n}m $n${csi}1;${n}m $n${csi}0m";done
            There's two colours for each number, a dim one, then (IMO) a less dim one. F.ex. Dim 33 is brown, and less dim 33 is yellow. To get the dim colour, just use that number, and for the other, put "1;" in front of the number. So, 1;33 for yellow. 40 to 47 set the background colour, so 1;33;44 is yellow on blue.

            If the basic 16 are not enough, konsole does RGB. F.ex., run
            Code:
            csi=$'\e['
            c=($(seq 8 32 255))
            for r in ${c[@]};do for g in ${c[@]};do for b in ${c[@]};do echo -n "${csi}38;2;$r;$g;${b}m$r;$g:$b ";done ;done ;done
            The RGB colour is prefixed with "38;2;", so yellow would be "38;2;255;255;0". Add "48;2;r;g;b" for the background colour, for yellow on blue "38;2;255;255;0;48;2;0;0;255".

            Having picked your colour, you can then put the codes for it in your PS1 variable. snowhog has pasted the standard debian stuff for this, but I think it's needlessly general; for example, mostly you know who you are, what system you're on, and that your konsole can do colour. I think also that you're very unlikely to be doing a debian chroot most of the time, if ever, so being reminded of that is unnecessary. So, I leave out the chroot stuff, \u for your user name, and \h for the host name. The \w for the "working directory" is useful, though. I also suggest adding the history number, it makes it easy to repeat stuff, that's "\!".

            So I suggest:
            Code:
            csi=$'\e['
            code="38;2;128;255;40" # greenish light yellow
            PS1='\[$csi${code}m\]\! \w \$\[${csi}0m\] '
            The place for that is your .bashrc file, but to experiment and try different colours just paste them into a konsole session, and make changes to the code variable.
            Regards, John Little

            Comment


              #7
              Thanks for the answers. Seems like a lot of work, so I'll have to do it after a trip I'm about to take. I rarely edit files, and am not really sure how to start.

              Comment

              Working...
              X