about summary refs log tree commit diff
path: root/Completion/User/_colors
blob: 4e9ee2030d746cc3806591df11426090989dc6b6 (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
#autoload

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

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

  if [[ -f /usr/lib/X11/rgb.txt ]]; then
    file=/usr/lib/X11/rgb.txt
  elif [[ -f /usr/local/lib/X11/rgb.txt ]]; then
    file=/usr/local/lib/X11/rgb.txt
  fi

  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[@]"