{"thread":{"id":"235","subject":"[PATCH] Colored log on any ANSI capable terminal","startedAt":"2005-04-22T01:42:17Z","lastAt":"2005-04-22T01:42:17Z","messageCount":1,"participants":["Pavel Roskin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"1228","messageId":"1114134137.12771.7.camel@dv","threadId":"235","inReplyTo":null,"subject":"[PATCH] Colored log on any ANSI capable terminal","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-04-22T01:42:17Z","receivedAt":"2005-04-22T01:42:17Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Hello!\n\nsetterm only works on Linux terminal.  It should be safe to use raw ANSI\nsequences -they work on most terminals, including xterm.  Nobody forces\nyou to use the \"-c\" option to \"git log\" on those stone-age terminals\nthat neither support nor ignore ANSI color codes.\n\nI'm aware of $'...' but it may not work in bash 1.x.\n\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n\n--- a/gitlog.sh\n+++ b/gitlog.sh\n@@ -12,11 +12,11 @@\n \n if [ \"$1\" = \"-c\" ]; then\n \tshift\n-\tcolheader=$(setterm -foreground green)\n-\tcolauthor=$(setterm -foreground cyan)\n-\tcolcommitter=$(setterm -foreground magenta)\n-\tcolsignoff=$(setterm -foreground yellow)\n-\tcoldefault=$(setterm -foreground default)\n+\tcolheader=$(echo -ne '\\e[32m')\n+\tcolauthor=$(echo -ne '\\e[36m')\n+\tcolcommitter=$(echo -ne '\\e[35m')\n+\tcolsignoff=$(echo -ne '\\e[33m')\n+\tcoldefault=$(echo -ne '\\e[39m')\n else\n \tcolheader=\n \tcolauthor=\n\n\n-- \nRegards,\nPavel Roskin\n\n"}]}