Skip to content

cskeeters/base16-konsole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base16 Konsole

This is a base16 template repository for konsole. Currently it includes two templates and corresponding output folders.

colorscheme-vim

The files in colorscheme-vim are designed to be compatible with base16-vim. The means the "intense" colors (8-15) have been repurposed (similarly to iterm2/dark.itermcolors.erb) to provide shades of grey and yellow colors needed for a good looking vim interface. Normally ansi 9 looks red, but instead it's mapped to base03 (grey) for base16-vim. To make the vim colorscheme compatible with this mapping, you must leave base16colorspace unset in .vimrc. Other applications like prompts and ls will look off as a consequence - although this can be mitigated as described below.

colorscheme

The files in colorscheme will not work with base16-vim, but colors will show up correctly in prompts and the colored output of ls.

Installation

To install system-wide, copy the desired files (not the folder) into the appropriate folder. You can download and install only one file if you know what theme you want to use.

KDE Version Available To Location
KDE 5 System Wide /usr/share/konsole
KDE 5 User Only ~/.local/share/konsole
KDE 4 System Wide /usr/share/kde4/apps/konsole
KDE 4 User Only ~/.kde4/apps/konsole/

NOTE: For *.schema files designed to work with the version of konsole included with KDE3, see base16-konsole-kde3.

You must restart konsole, then you can select the theme you would like to use through the menus.

Vim Configuration

Follow the instructions for installation of base16-vim. Do not set base16colorspace!

Airline

In RHEL6, vim shows my airline status with bright yellow forground colors instead of darker colors. It's using ctermfg=10, but 10 seems to be set correctly. I'm not sure why, but changing term=bold to term=NONE fixes the issue. The easiest way to do this is to remove bold from the string value on this line.

junegunn/fzf

If you use fzf and want colorization to look right, you'll need something like this in your .bashrc.

if [[ $TERM =~ konsole.* ]]; then
    export FZF_DEFAULT_OPTS='--color fg+:5,hl+:6'
fi

This is due to fzf using intense versions of colors. Since most are dark, the selected item winds up being hard to see. With FZF_DEFAULT_OPTS as mentioned, the selected item will be white and matching text will be orange. Those are the only good colors to use.

ls colorization

With kde4-konsole-vim, ls --color shows many items in a dark color that is hard to see. To correct this, you need to set the LS_COLORS environment variable to not use bright intensity colors. You can do this most easily with dircolors. See the dir_colors manpage for additional details. The process for removing intensity code (01) from LS_COLORS is:

  1. Copy /etc/DIR_COLORS to ~/.dir_colors
  2. Edit ~/.dir_colors and modify entries to remove 01;. For example, DIR 01;34 should become, DIR 34.
  3. Logout and log back in, or run eval $(dircolors ~/.dir_colors)

A base16-vim compatible file is available for you to download if you don't need any further customization.

cd ~
curl -OL https://gist.githubusercontent.com/cskeeters/aacd10c075d3c7092a5e4e36db34e62d/raw/.dir_colors

Mercurial Configuration

If you use the color extension for hg, you'll need to customize the colors so that bold is not used. Add this to your ~/.hgrc.

[color]
status.modified = blue
status.added = green
status.removed = red
status.deleted = cyan
status.unknown = magenta
status.ignored = yellow

diff.extended = cyan
diff.file_a = red
diff.file_b = green
diff.trailingwhitespace = red_background

qseries.applied = blue underline
qseries.unapplied = yellow
qseries.missing = red

Advanced Configuration

If you are like me and want a single .vimrc to function for konsole (in 16 color mode) and another terminal which supports 256 colors, you can configure konsole's environment to set TERM=konsole and then only set base16colorspace when TERM does not start with konsole

if $TERM !~# "konsole.*"
    " As a work around for the following bugs in kde4's konsole:
    "   use the output of 16.colorscheme.rb and don't set base16colorspace.
    "   base-shell script will not be called
    " https://github.com/chriskempson/base16-shell/issues/31
    " https://bugs.kde.org/show_bug.cgi?id=344181
    let base16colorspace=256
endif

Technical Details

ANSI colors can be set in a terminal in two ways.

  1. Using the menus to load some settings file, or through .Xresources.
  2. Set by sending ANSI operating system commands to the terminal.

If

  • bright colors (8-15) are set to the same or similar color with the standard ansi colors (0-7),
  • Colors 16-20 are set using either method above to dark/orange colors.
  • let base16colorspace=256 is set in .vimrc

then everything works great.

Unfortunately, most terminal's only allow you to set colors 0-15. Konsole is no exception. Since konsole doesn't support xterm's operating system command to set those colors (ala base16-shell), there is no point in using it and base16-vim can not operate in a 256 colorspace. Fortunately, base16-vim can function with base16colorspace not set if the black and orange characters are set in colors 8-15. This template repository provides colorscheme files where colors 8-15 have the black/orange colors needed.

Fortunately, base16-vim is designed to be able to To use vim with vim-base16 in konsole, we must use this 16-color pallet version and be sure to NOT set base16colorspace=256 in vimrc.

Further reading/references on ANSI codes

For those interested, you can check out the spec xterm's documentation on operating system commands:

    OSC    Ps   ;    Pt                             ST
    ESC ]  4    ;    <ColorNumber> ; rgb:FF/00/00   ESC \

Under Ps = 4, you can read.

This can be a name or RGB specification as per XParseColor.

man 3 xparsecolor shows under Color Names supporting the rgb:<red>/<green>/<blue> format.

base16-shell uses this corresponding template to set the color:

printf_template='\033]4;%d;rgb:%s\033\\'

About

Base16 template repository for konsole

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages