Results 1 to 4 of 4

Thread: Konsole: Color schemes?

  1. #1
    Join Date
    Mar 2013
    Location
    Dallas, Texas (not a Native )
    Posts
    17

    Default Konsole: Color schemes?

    If you enter setting on the Konsole menu, it gives you the option to edit the current profile, and you can also
    create new ones. When you enter the appearance tab, there are a number of color schemes to choose from:
    and there are 20 "colors" , Background/Foreground and 8 numbered each in two categories, "Normal" and "Intense"
    How are these mapped, where are the mapping files to be found. Reason, I like to change the colors, and always
    end up spending time trying to figure out what color goes to what "code". Example; when the "if" word in a sh script
    turns out to be yellow on white your eyes get tired very quickly, or a pastel blue cursor on top of a pair of blue "{}"
    can drive you totally crazy. And of course, change to a perl script, well you get the idea.

    Any help appreciated!

    frankeG

  2. #2
    Join Date
    Mar 2010
    Location
    Austin - Texas
    Posts
    10,140
    Blog Entries
    48

    Smile Re: Konsole: Color schemes?

    Quote Originally Posted by frankeG View Post
    If you enter setting on the Konsole menu, it gives you the option to edit the current profile, and you can also
    create new ones. When you enter the appearance tab, there are a number of color schemes to choose from:
    and there are 20 "colors" , Background/Foreground and 8 numbered each in two categories, "Normal" and "Intense"
    How are these mapped, where are the mapping files to be found. Reason, I like to change the colors, and always
    end up spending time trying to figure out what color goes to what "code". Example; when the "if" word in a sh script
    turns out to be yellow on white your eyes get tired very quickly, or a pastel blue cursor on top of a pair of blue "{}"
    can drive you totally crazy. And of course, change to a perl script, well you get the idea.

    Any help appreciated!

    frankeG
    I am not sure I understand your question. An application like Konsole allows you to change the default colors and any terminal application you run could change that to something else as well. While you have control of the default, you may not have control of a CLI application and there is little you can do about it except change the source code I suppose. As an example of how to set colors in a bash script, take a look at this function block:

    Code:
    # *****************************************************************************
    # Do you want to see sact in color? The default is true, but can be set  
    # to false - New Escape Sequences works without a Desktop loaded 
    # *****************************************************************************
    
    use_color=true
    
    # *****************************************************************************
    # Color Display Request - color forground background [b/n] 
    #              Called from more than 10 locations in program
    #
    # 0:Black  1:Blue  2:Green  3:Cyan  4:Red  5:Magenta  6:Yellow  7:White
    #
    # Example: color 7 0 B 
    #
    # where forground is white (7), backgroud is black (0) and text is in bold (B)
    #                          $1                      $2                      $3
    # *****************************************************************************
    
    function color {
      if $use_color ; then
        if [[ $3 == [Nn] ]] ; then
          tput sgr0
        fi
        if [[ $3 == [Bb] ]] ; then
          case "$1" in
            "0") echo -ne '\E[1;30m' ;;
            "1") echo -ne '\E[1;34m' ;;
            "2") echo -ne '\E[1;32m' ;;
            "3") echo -ne '\E[1;36m' ;;
            "4") echo -ne '\E[1;31m' ;;
            "5") echo -ne '\E[1;35m' ;;
            "6") echo -ne '\E[1;33m' ;;
            "7") echo -ne '\E[1;37m' ;;
            *) echo -ne '\E[1;37m' ;;
          esac
        else
          case "$1" in
            "0") echo -ne '\E[30m' ;;
            "1") echo -ne '\E[34m' ;;
            "2") echo -ne '\E[32m' ;;
            "3") echo -ne '\E[36m' ;;
            "4") echo -ne '\E[31m' ;;
            "5") echo -ne '\E[35m' ;;
            "6") echo -ne '\E[33m' ;;
            "7") echo -ne '\E[37m' ;;
            *) echo -ne '\E[37m' ;;
          esac
        fi
        case "$2" in
          "0") echo -ne '\E[40m' ;;
          "1") echo -ne '\E[44m' ;;
          "2") echo -ne '\E[42m' ;;
          "3") echo -ne '\E[46m' ;;
          "4") echo -ne '\E[41m' ;;
          "5") echo -ne '\E[45m' ;;
          "6") echo -ne '\E[43m' ;;
          "7") echo -ne '\E[47m' ;;
          *) echo -ne '\E[40m' ;;
        esac
      else
        echo -ne '\E[37;40m' 
      fi
      return 0
    }
    Thank You,
    My Blog: https://forums.opensuse.org/blogs/jdmcdaniel3/

    Software efficiency halves every 18 months, thus compensating for Moore's Law

    Its James again from Austin, Texas

  3. #3
    Join Date
    Mar 2013
    Location
    Dallas, Texas (not a Native )
    Posts
    17

    Default Re: Konsole: Color schemes?

    Thank you, James, I will play with the script you included to get more acquainted with colors;
    but,
    Put another way, and using the Konsole reference:
    open Konsole, select "Settings" from the menubar, then
    "Edit current profile" from the drop-down,
    and click the "Appearance" tab from the panel presented
    list of "Color Schemes & Backgrounds" appears.
    Select any one, a pop-up appears
    (it gives the list of the current 20 colors used by the selected scheme.)
    As you point out, you can change any of them. What I want to know is where is the file(s) that contain
    the original and your changed selections?
    My interest is piqued by the fact that vi, for example, applies the colors to anything you type much like
    an IDE, Komodo as example, does; without satisfactory results.

    Sincerely,
    Frank G
    Can you clarify my lack of knowledge, what is "CLI"?

  4. #4

    Default Re: Konsole: Color schemes?

    Colorschemes are saved as *.colorscheme files. Edited ones locate in: "~/.kde[4]/share/apps/konsole/" and default ones in "/usr/share/kde4/apps/konsole/" at least in openSUSE.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •