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

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

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

  for f in /usr/{,local/,X11R6/,openwin/}lib/X11/rgb.txt
  do
    if [[ -f $f ]]; then
      file=$f
      break;
    fi
  done

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

    # Stupid default value.

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

compadd - "$_color_cache[@]"