Color schemes

From Vifm Wiki
Jump to: navigation, search

Color scheme Files[edit]

Location[edit]

$HOME/.vifm/colors/

Command syntax[edit]

From $HOME/.vifm/colors/Default:

" You can edit this file by hand.
" The " character at the beginning of a line comments out the line.
" Blank lines are ignored.

" The Default color scheme is used for any directory that does not have
" a specified scheme and for parts of user interface like menus. A
" color scheme set for a base directory will also
" be used for the sub directories.

" The standard ncurses colors are:
" Default = -1 = None, can be used for transparency or default color
" Black = 0
" Red = 1
" Green = 2
" Yellow = 3
" Blue = 4
" Magenta = 5
" Cyan = 6
" White = 7

" Light versions of colors are also available (set bold attribute):
" LightBlack
" LightRed
" LightGreen
" LightYellow
" LightBlue
" LightMagenta
" LightCyan
" LightWhite

" Available attributes (some of them can be combined):
" bold
" underline
" reverse or inverse
" standout
" none

" Vifm supports 256 colors you can use color numbers 0-255
" (requires properly set up terminal: set your TERM environment variable
" (directly or using resources) to some color terminal name (e.g.
" xterm-256color) from /usr/lib/terminfo/; you can check current number
" of colors in your terminal with tput colors command)

" highlight group cterm=attrs ctermfg=foreground_color ctermbg=background_color

Preparing your terminal[edit]

There are a variety of possibilities for how you terminal deals with color. Your terminal emulator will be capable of up a certain number of colors. Some possibilities are: 8, 8+8(bold as light colors), 16, and 256 colors. Your Terminal communicates which colors it can handle by setting the $TERM variable. This should not be set manually in .bashrc, but in your terminal's configuration. For xterm and some xterm compatible

  • light vs bold

Terminal Specific Tips[edit]

xterm[edit]

Permanently Applying Color schemes[edit]

The color schemes in vifm can be applied in two different ways:

  1. as the default (or main) color scheme
  2. as local to a panel color scheme


Both types are set using |vifm−:colorscheme| command, but of different forms:

  1. :colorscheme color_scheme_name − for the default color scheme
  2. :colorscheme color_scheme_name directory − for local color schemes

Look of different parts of the TUI (Text User Interface) is determined in this way:

  1. Border, TopLineSel, TopLine, CmdLine, ErrorMsg, StatusLine and WildMenu are always determined by the default color scheme
  2. CurrLine, Selected, Directory, Link, BrokenLink, Socket, Device, Executable, Fifo and Win are determined by default color scheme and a set of local colorschemes, which can be empty

There might be a set of local color schemes because they are structured hierarchically according to file system structure. For example, having the following piece of file system:

~
’−− bin
   |
   ’−− my

Two color schemes:

# ~/.vifm/colors/for_bin
----
highlight Win cterm=none ctermfg=white ctermbg=red
highlight CurrLine cterm=none ctermfg=red ctermbg=black


# ~/.vifm/colors/for_bin_my
----
highlight CurrLine cterm=none ctermfg=green ctermbg=black


# ~/.vifm/vifmrc
----
colorscheme Default
colorscheme for_bin ~/bin
colorscheme for_bin_my ~/bin/my

File list will look in the following way for each level:

~/ − Default color scheme

black background; cursor with blue background


~/bin/ − mix of Default and for_bin color schemes

red background; cursor with black background and red foreground


~/bin/my/ − mix of Default, for_bin and for_bin_my color schemes

red background; cursor with black background and green foreground

User Color schemes[edit]

Importing ls color scheme as a base[edit]

TODO

Tips for Customizing[edit]

TODO

Add Your Custom Colors schemes Here[edit]

Include:

  • Terminal Specifications/Pallet
  • vifm Color scheme commands

Color Schemes[edit]

Example Color scheme:[edit]

$HOME/.Xresources:

! Common
#define S_yellow #b58900
#define S_orange #cb4b16
#define S_red #dc322f
#define S_magenta #d33682
#define S_violet #6c71c4
#define S_blue #268bd2
#define S_cyan #2aa198
#define S_green #859900

! Dark
#define S_base03 #002b36
#define S_base02 #073642
#define S_base01 #586e75
#define S_base00 #657b83
#define S_base0 #839496
#define S_base1 #93a1a1
#define S_base2 #eee8d5
#define S_base3 #fdf6e3

! Light

! #define S_base03 #fdf6e3
! #define S_base02 #eee8d5
! #define S_base01 #93a1a1
! #define S_base00 #839496
! #define S_base0 #657b83
! #define S_base1 #586e75
! #define S_base2 #073642
! #define S_base3 #002b36

$HOME/.vifm/colors/solarized-16color:

" colorscheme: solarized-16color
" Version: 1.0
" Author: Stéphane (a.k.a. istib)
" Edited by: y2kbugger 18JUL2014
" Now with all 16 colors in solarized pallet + bold
"  support. Tweaked to adhere more strictly to
"  solarized usage guidelines. Can be used in Light
"  or Dark mode.
"  see http://ethanschoonover.com/solarized#usage-development
" map colors from solarized scheme to ncurses:
" ------------------------------------------
"             ncurses/            CIELAB
" solarized   terminal       ##   lightness   
" ------------------------------------------
" NA          default/none   -1    NA

" base03      lightblack     08    15     
" base02      black          00    20     
" base01      lightgreen     10    45     
" base00      lightyellow    11    50     
" base0       lightblue      12    60     
" base1       lightcyan      14    65     
" base2       white          07    92     
" base3       lightwhite     15    97     

" yellow      yellow         03    60     
" orange      lightred       09    50     
" red         red            01    50     
" magenta     magenta        05    50     
" violet      lightmagenta   13    50     
" blue        blue           04    55     
" cyan        cyan           06    60     
" green       green          02    60     

highlight Win           ctermfg=12 ctermbg=08 cterm=none

highlight TopLine       ctermfg=04 ctermbg=08 cterm=none
highlight TopLineSel    ctermfg=04 ctermbg=00 cterm=none
highlight StatusLine    ctermfg=04 ctermbg=00 cterm=none
highlight Border        ctermfg=04 ctermbg=00 cterm=none

highlight Selected      ctermfg=-1 ctermbg=00 cterm=none
highlight CurrLine      ctermfg=-1 ctermbg=-1 cterm=standout

highlight WildMenu      ctermfg=07 ctermbg=-1 cterm=underline
highlight CmdLine       ctermfg=14 ctermbg=-1 cterm=none
highlight ErrorMsg      ctermfg=01 ctermbg=00 cterm=none

highlight Directory     ctermfg=12 ctermbg=-1 cterm=bold
highlight Link          ctermfg=03 ctermbg=-1 cterm=none
highlight BrokenLink    ctermfg=01 ctermbg=-1 cterm=none
highlight Socket        ctermfg=05 ctermbg=-1 cterm=none
highlight Device        ctermfg=01 ctermbg=-1 cterm=none
highlight Fifo          ctermfg=06 ctermbg=-1 cterm=none
highlight Executable    ctermfg=02 ctermbg=-1 cterm=none

Troubleshooting[edit]

How to list all available terminal types[edit]

terminfo database is stored in /usr/share/terminfo/ directory. They all are sorted in directories named by first letter of terminal type name. Here is a command that lists all of them in less:

find /usr/share/terminfo/ -type f -printf '%f\n' | sort | less

Determining number of colors supported by a terminal[edit]

tput utility can query terminfo database for number of colors supported by the terminal. Terminal type is determined from value of $TERM environment variable. It takes argument which specifies terminal property to query, colors property corresponds to number of supported colors.

Examples:

$ echo $TERM
screen-256color
$ tput colors
256
$ TERM=xterm tput colors
8
$ TERM=xterm-16color tput colors
16