git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Colored log on any ANSI capable terminal
@ 2005-04-22  1:42 Pavel Roskin
  0 siblings, 0 replies; only message in thread
From: Pavel Roskin @ 2005-04-22  1:42 UTC (permalink / raw)
  To: git

Hello!

setterm only works on Linux terminal.  It should be safe to use raw ANSI
sequences -they work on most terminals, including xterm.  Nobody forces
you to use the "-c" option to "git log" on those stone-age terminals
that neither support nor ignore ANSI color codes.

I'm aware of $'...' but it may not work in bash 1.x.

Signed-off-by: Pavel Roskin <proski@gnu.org>

--- a/gitlog.sh
+++ b/gitlog.sh
@@ -12,11 +12,11 @@
 
 if [ "$1" = "-c" ]; then
 	shift
-	colheader=$(setterm -foreground green)
-	colauthor=$(setterm -foreground cyan)
-	colcommitter=$(setterm -foreground magenta)
-	colsignoff=$(setterm -foreground yellow)
-	coldefault=$(setterm -foreground default)
+	colheader=$(echo -ne '\e[32m')
+	colauthor=$(echo -ne '\e[36m')
+	colcommitter=$(echo -ne '\e[35m')
+	colsignoff=$(echo -ne '\e[33m')
+	coldefault=$(echo -ne '\e[39m')
 else
 	colheader=
 	colauthor=


-- 
Regards,
Pavel Roskin


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-22  1:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-22  1:42 [PATCH] Colored log on any ANSI capable terminal Pavel Roskin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).