New helper for colors
authorJoerg Jaspert <joerg@debian.org>
Mon, 11 Mar 2013 00:00:07 +0000 (01:00 +0100)
committerJoerg Jaspert <joerg@debian.org>
Mon, 11 Mar 2013 00:00:07 +0000 (01:00 +0100)
.zsh/05_Functions.zsh

index c51d7ed..04f4604 100644 (file)
@@ -69,3 +69,24 @@ if is434; then
         fi
     }
 fi
+
+docolors()
+{
+    if zrcautoload colors && colors 2>/dev/null ; then
+        for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
+            eval BOLD_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
+            eval $color='%{$fg[${(L)color}]%}'
+            (( count = $count + 1 ))
+        done
+        NO_COLOR="%{${reset_color}%}"
+    else
+        BLUE=$'%{\e[1;34m%}'
+        RED=$'%{\e[1;31m%}'
+        GREEN=$'%{\e[1;32m%}'
+        CYAN=$'%{\e[1;36m%}'
+        WHITE=$'%{\e[1;37m%}'
+        MAGENTA=$'%{\e[1;35m%}'
+        YELLOW=$'%{\e[1;33m%}'
+        NO_COLOR=$'%{\e[0m%}'
+    fi
+}