about summary refs log tree commit diff
path: root/Completion/User/_colors
blob: 7a7b0824b42e81fa5ec1f0acd7d28f9b08194327 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#autoload

if (( ! $+_color_cache )); then
  local file

  # Cache of color names doesn't exist yet, create it.

  file=( /usr/{lib,{{X11R6,openwin},local{,/X11{,R6}}}/lib}/X11/rgb.txt )

  if (( $#file )); then
    _color_cache=( "${(@)${(@f)$(< $file[1])}[2,-1]##*		}" )
  else

    # Stupid default value.

    _color_cache=(white black gray red blue green)
  fi
fi

compadd -M 'm:{a-z}={A-Z} m:-=\  r:|[ A-Z0-9]=* r:|=*' - "$_color_cache[@]"