about summary refs log tree commit diff
path: root/Completion/X/_x_color
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-08-31 10:23:46 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-08-31 10:23:46 +0000
commit39143d5c619b98e51e7c5f69d5d12440e8272942 (patch)
tree00bc4515e1024f0c7782962b9047e07643756f06 /Completion/X/_x_color
parente6e268d99593081e18e52888407f0c397c991ff1 (diff)
downloadzsh-39143d5c619b98e51e7c5f69d5d12440e8272942.tar.gz
zsh-39143d5c619b98e51e7c5f69d5d12440e8272942.tar.xz
zsh-39143d5c619b98e51e7c5f69d5d12440e8272942.zip
Initial revision
Diffstat (limited to 'Completion/X/_x_color')
-rw-r--r--Completion/X/_x_color24
1 files changed, 24 insertions, 0 deletions
diff --git a/Completion/X/_x_color b/Completion/X/_x_color
new file mode 100644
index 000000000..346142eea
--- /dev/null
+++ b/Completion/X/_x_color
@@ -0,0 +1,24 @@
+#autoload
+
+local expl
+
+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(N) )
+
+  if (( $#file )); then
+    _color_cache=( "${(@)${(@f)$(< $file[1])}[2,-1]##*		}" )
+  else
+
+    # Stupid default value.
+
+    _color_cache=(white black gray red blue green)
+  fi
+fi
+
+_description expl 'color specification'
+compadd "$@" "$expl[@]" -M 'm:{a-z}={A-Z} m:-=\  r:|[ A-Z0-9]=* r:|=*' - \
+        "$_color_cache[@]"