about summary refs log tree commit diff
path: root/Completion/User/_colors
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-08-12 21:25:12 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-08-12 21:25:12 +0000
commitd00f73c3672b2783f14e3a27b35d34c218657506 (patch)
tree55bd4876283ca101a0d99f790c0c8c7174efa44d /Completion/User/_colors
parent98aaef0a46c8d9d1c34dd939fd8a470791aed2ee (diff)
downloadzsh-d00f73c3672b2783f14e3a27b35d34c218657506.tar.gz
zsh-d00f73c3672b2783f14e3a27b35d34c218657506.tar.xz
zsh-d00f73c3672b2783f14e3a27b35d34c218657506.zip
zsh-workers/7420
Diffstat (limited to 'Completion/User/_colors')
-rw-r--r--Completion/User/_colors24
1 files changed, 24 insertions, 0 deletions
diff --git a/Completion/User/_colors b/Completion/User/_colors
new file mode 100644
index 000000000..4e9ee2030
--- /dev/null
+++ b/Completion/User/_colors
@@ -0,0 +1,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[@]"