Terminal Font-Color

Forum Forums General Software Terminal Font-Color

  • This topic has 12 replies, 4 voices, and was last updated May 12-5:53 am by Anonymous.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #21413
    Anonymous

      On the screenshots below, you can see the default Devuan Terminal and the Good Life Linux (Devuan moded) Terminal.

      I always thought, that the font colors of Terminals are saved in the “.bashrc” but now, I’m not so sure any more …

      The reason:

      If I put the moded ‘.bashrc’ (with blue font) in place of original (green/white font) ‘.bashrc’ file, not only that it’s not getting the same blue font but, even the green/white font is gone and only the white everywhere is left.

      Does anybody understand and could/wants to explain where that color comes from and where that color information is saved?

      As usual, I’m just trying to understand / learn something again.

      Thanks.

      #21416
      Member
      Flamefre
        Helpful
        Up
        0
        ::

        .bashrc is the place where you can set the terminal colors and there you can specify the tags you want tot see. In Antix on .bashrc on line 52 until 57 there is an if statement where you can set the color_prompt to yes.

        About the color settings, maybe this page will help on how the colors work.
        https://misc.flogisoft.com/bash/tip_colors_and_formatting

        #21418
        Anonymous
          Helpful
          Up
          0
          ::

          Thanks for the reply and for the link.

          Unfortunately, I didn’t get any ‘smarter’ then before. 🙁

          Following the logic, if I swap the original Devuan XFCE green colored ‘.bashrc’ with a GLL Devuan XFCE blue colored ‘.bashrc’ and if that ‘strange number’ (== color code) is saved only in ‘.bashrc’ file, it should result in a color swap from green to blue but, it doesn’t and it changes the color to white.

          #21420
          Member
          Flamefre
            Helpful
            Up
            0
            ::

            I am not entirely sure, but if the bash color goes to white again, the default bash.settings in /etc/bash.bashrc are probably overriding the profile settings.

            And maybe an coding error in the profile settings.

            I provided my bash below. Maybe it gives a clue on how to enable the settings on your machine

            
            # ~/.bashrc: executed by bash(1) for non-login shells.
            # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
            # for examples
            
            # If not running interactively, don't do anything
            case $- in
                *i*) ;;
                  *) return;;
            esac
            
            # don't put duplicate lines or lines starting with space in the history.
            # See bash(1) for more options
            HISTCONTROL=ignoreboth
            
            # append to the history file, don't overwrite it
            shopt -s histappend
            
            # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
            HISTSIZE=1000
            HISTFILESIZE=2000
            
            # check the window size after each command and, if necessary,
            # update the values of LINES and COLUMNS.
            shopt -s checkwinsize
            
            # If set, the pattern "**" used in a pathname expansion context will
            # match all files and zero or more directories and subdirectories.
            #shopt -s globstar
            
            # make less more friendly for non-text input files, see lesspipe(1)
            #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
            
            # set variable identifying the chroot you work in (used in the prompt below)
            if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
                debian_chroot=$(cat /etc/debian_chroot)
            fi
            
            # 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[00;36m\]\u@\h\[\033[00m\]:\[\033[00;36m\]\w\[\033[00m\]\$ '
            else
                PS1='${debian_chroot:+($debian_chroot)}\[\033[38;5;92m\]\u@\[\033[38;5;37m\]\h:\w\$ '
            fi
            unset color_prompt force_color_prompt
            
            # If this is an xterm set the title to user@host:dir
            case "$TERM" in
            xterm*|rxvt*)
                PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
                ;;
            *)
                ;;
            esac
            
            # enable color support of ls and also add handy aliases
            if [ -x /usr/bin/dircolors ]; then
                test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
                alias ls='ls --color=auto'
                #alias dir='dir --color=auto'
                #alias vdir='vdir --color=auto'
            
                #alias grep='grep --color=auto'
                #alias fgrep='fgrep --color=auto'
                #alias egrep='egrep --color=auto'
            fi
            
            # colored GCC warnings and errors
            export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
            
            # some more ls aliases
            alias ll='ls -l'
            alias la='ls -A'
            alias l='ls -CF'
            
            # Alias definitions.
            # You may want to put all your additions into a separate file like
            # ~/.bash_aliases, instead of adding them here directly.
            # See /usr/share/doc/bash-doc/examples in the bash-doc package.
            
            if [ -f ~/.bash_aliases ]; then
                . ~/.bash_aliases
            fi
            
            # enable programmable completion features (you don't need to enable
            # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
            # sources /etc/bash.bashrc).
            if ! shopt -oq posix; then
              if [ -f /usr/share/bash-completion/bash_completion ]; then
                . /usr/share/bash-completion/bash_completion
              elif [ -f /etc/bash_completion ]; then
                . /etc/bash_completion
              fi
            fi
            • This reply was modified 3 years, 12 months ago by Flamefre. Reason: added my bash script
            #21423
            Member
            Flamefre
              Helpful
              Up
              0
              ::

              Couldn’t find the link before, but if you want to change the colors in your bashrc, than maybe http://bashrcgenerator.com/bashrcgenerator is more helpful. On this webpage you can check your settings and generate the ps1 line to copy into bashrc

              #21426
              Anonymous
                Helpful
                Up
                0
                ::

                Thanks again, I’ll give it try just to check what will happen.
                Actually, I don’t wanna change the color.
                Just trying to understand it.

                #21427
                Member
                Flamefre
                  Helpful
                  Up
                  0
                  ::

                  I hope you will get to understand how it works. Once you get the concept it is not so hard, but it took me a few days and sighs to grasp the workings of bash on linux.

                  Good luck

                  #21428
                  Anonymous
                    Helpful
                    Up
                    0
                    ::

                    Well … I guess, that’s what makes Linux. 😉
                    Thanks!

                    #21449
                    Anonymous
                      Helpful
                      Up
                      0
                      ::

                      Many terminal emulator appications provide application-specific, configurable, color “schemes” or “profiles”.

                      For lxterminal, see ~.config/lxterminal/lxterminal.conf
                      ( this is where the details exposed via edit-}preferences-}style are stored )

                      For urxvt (aka ‘rxvt’ aka ‘rxvt-unicode’), see the file /etc/X11/app-defaults/URxvt
                      Also (specific to antiX) see: urxvt-sytle –help
                      ( reads color palatte data from the subdirectories of /usr/local/lib/urxvt/Xresources/ )
                      Beyond colors, urxvt is highly configurable (customizable). See: apropos urxvt

                      For roxterm, see the “Colours” and “Profiles” subdirectories of ~/.config/roxterm.sourceforge.net/
                      ( this is where details set via the roxterm-config UI are stored )

                      For xfce4-terminal, see the subdirectories of /usr/share/xfce4/terminal/colorschemes/
                      and the file ~/.config/xfce4/terminal/terminalrc

                      edit:
                      urxvt-sytle –help
                      dash dash help (the forum software mangles, converts dash dash to a longdash character)

                      #21457
                      Anonymous
                        Helpful
                        Up
                        0
                        ::

                        Many thanks skidoo. Will take a look in the following days.
                        Starts making sense! 😉

                        #21461
                        Member
                        ex_Koo
                          Helpful
                          Up
                          0
                          ::

                          I had to change the dir_colors line in my bashrc to get the colors to work with antiX this also works with Debian.
                          The new colors line below…

                          # enable color support of ls and also add handy aliases
                          if [ -x /usr/bin/dircolors ]; then
                              eval "$(dircolors ~/.dir_colors)"

                          As pre this post on MX..

                          MX post

                          #21462
                          Member
                          ex_Koo
                            Helpful
                            Up
                            0
                            ::

                            I also see that your xterm line may need editing.?

                            # set a fancy prompt (non-color, unless we know we "want" color)
                            case "$TERM" in
                                xterm-color) color_prompt=yes;;
                            esac

                            My prompt line.

                            export PS1="\n\[\e[1;31m\]┏>>>{\[\e[0m\]\d \@\[\e[1;31m\]}\[\e[1;35m\]\j:\! \# \[\e[1;31m\]\[\e[0m\]\n┗>>>\[\e[1;32m\]\[\033[4;32m\]\u@\h ~ \[\e[4;36m\]\$(/bin/ls -1 | /usr/bin/wc -l | /bin/sed 's: ::g') files = \[\e[1;33m\]\$(/bin/ls -lah | /bin/grep -m 1 total | /bin/sed 's/total //') \w\[\e[0m\] >$

                            Color codes list.
                            black='\[\e[1;101m\]'
                            BLACK='\[\e[1;30m\]'
                            red='\[\e[0;31m\]'
                            RED='\[\e[1;31m\]'
                            blue='\[\e[0;34m\]'
                            BLUE='\[\e[1;34m\]'
                            cyan='\[\e[0;36m\]'
                            CYAN='\[\e[1;36m\]'
                            green='\[\e[0;32m\]'
                            GREEN='\[\e[1;32m\]'
                            yellow='\[\e[0;33m\]'
                            YELLOW='\[\e[1;33m\]'
                            PURPLE='\[\e[1;35m\]'
                            purple='\[\e[0;35m\]'
                            nc='\[\e[0m\]'

                            You can also list the directories first.

                               alias la='ls -a --group-directories-first --color=auto'
                                alias ls='ls -a --group-directories-first --color=auto'
                                alias ll='ls -la --group-directories-first --color=auto'

                            Your .Xresources has nothing to do with dir_colors only used to setup your terminal.

                            This is part of my .Xresources file

                            URxvt.transparent: true
                            URxvt.tintColor: Blue
                            
                            URxvt.saveLines: 12000
                            URxvt.foreground: White
                            URxvt.background: Blue
                            URxvt.color4: RoyalBlue
                            URxvt.color12: RoyalBlue
                            
                            URxvt.scrollBar: false
                            URxvt.scrollBar_right: false
                            URxvt.scrollstyle: rxvt
                            
                            ! --- Special features Perl ---!!!
                            URxvt.perl-lib:              /usr/lib/x86_64-linux-gnu/urxvt/perl/
                            URxvt.perl-ext-common:	default,resize-font,matcher,clipboard,url-select,config-reload
                            URxvt.keysym.C-Up:     font-size:increase
                            URxvt.keysym.C-Down:   font-size:decrease
                            URxvt.keysym.C-S-Up:   font-size:incglobal
                            URxvt.keysym.C-S-Down: font-size:decglobal
                            URxvt.keysym.C-equal:  font-size:reset
                            
                            URxvt.font: xft:Bitstream Vera Sans Mono:pixelsize=12:antialias=true:hinting=true

                            Also Do you have .dir_colors file in your Home directory if it doesn’t exist you can create it with:

                            .dircolors -p > ~/.dir_colors

                            Hope this is of some help..

                            You can also test your prompts like this..

                            • This reply was modified 3 years, 12 months ago by ex_Koo.
                            #21478
                            Anonymous
                              Helpful
                              Up
                              0
                              ::

                              Thanks koo, I’ll check on that too.

                            Viewing 13 posts - 1 through 13 (of 13 total)
                            • You must be logged in to reply to this topic.