{"thread":{"id":"37924","subject":"[PATCH] Custom prompt colors","startedAt":"2014-11-10T09:42:23Z","lastAt":"2014-11-10T10:37:35Z","messageCount":2,"participants":["Vanja Radovanović"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"251665","messageId":"CAC2nwfcuPLKr-kpt-G1uUmMoZs8T+pg9uJWP5oxMea60xg09=g@mail.gmail.com","threadId":"37924","inReplyTo":null,"subject":"[PATCH] Custom prompt colors","fromName":"Vanja Radovanović","fromEmail":"elvanja@gmail.com","sentAt":"2014-11-10T09:42:23Z","receivedAt":"2014-11-10T09:42:23Z","isPatch":true,"sender":{"key":"elvanja@gmail.com","avatar":null},"body":">From 41e9edae533306b4a50570e32dbbdd291a4a5fbf Mon Sep 17 00:00:00 2001\nFrom: =?UTF-8?q?Vanja=20Radovanovi=C4=87?= <elvanja@gmail.com>\nDate: Sun, 9 Nov 2014 20:05:48 +0100\nSubject: [PATCH] contrib/completion: custom git prompt colors\n\nAllow git prompt colors to be customized.\nAccept globally set colors, use defaults otherwise.\n\nNote: requires /usr/lib/git-core/git-sh-promp to be\nremoved or commented out, so custom git-prompt.sh\ncan be used.\n---\n contrib/completion/git-prompt.sh | 18 +++++++++++++++++-\n 1 file changed, 17 insertions(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\nindex c5473dc..ff5b04b 100644\n--- a/contrib/completion/git-prompt.sh\n+++ b/contrib/completion/git-prompt.sh\n@@ -84,6 +84,10 @@\n # GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on\n # the colored output of \"git status -sb\" and are available only when\n # using __git_ps1 for PROMPT_COMMAND or precmd.\n+# Colors can be overridden; just set GIT_PS1_BAD_COLOR,\n+# GIT_PS1_OK_COLOR and/or GIT_PS1_FLAGS_COLOR to the color of your choice.\n+# Make sure you use appropriately escaped color codes, see\n+# __git_ps1_colorize_gitstring function for details/defaults.\n\n # check whether printf supports -v\n __git_printf_supports_v=\n@@ -240,9 +244,21 @@ __git_ps1_colorize_gitstring ()\n  local c_lblue='\\[\\e[1;34m\\]'\n  local c_clear='\\[\\e[0m\\]'\n  fi\n+\n  local bad_color=$c_red\n+  if [ -n \"${GIT_PS1_BAD_COLOR-}\" ]; then\n+    bad_color=$GIT_PS1_BAD_COLOR\n+  fi\n+\n  local ok_color=$c_green\n- local flags_color=\"$c_lblue\"\n+  if [ -n \"${GIT_PS1_OK_COLOR-}\" ]; then\n+    ok_color=$GIT_PS1_OK_COLOR\n+  fi\n+\n+  local flags_color=\"$c_lblue\"\n+  if [ -n \"${GIT_PS1_FLAGS_COLOR-}\" ]; then\n+    flags_color=$GIT_PS1_FLAGS_COLOR\n+  fi\n\n  local branch_color=\"\"\n  if [ $detached = no ]; then\n-- \n2.1.3\n"},{"id":"251666","messageId":"CAC2nwfdU5i+=JugCjoLjRo0uwWMTt-_+H0akYpdmiWoK+mFSSg@mail.gmail.com","threadId":"37924","inReplyTo":"CAC2nwfcuPLKr-kpt-G1uUmMoZs8T+pg9uJWP5oxMea60xg09=g@mail.gmail.com","subject":"Re: [PATCH] Custom prompt colors","fromName":"Vanja Radovanović","fromEmail":"elvanja@gmail.com","sentAt":"2014-11-10T10:37:35Z","receivedAt":"2014-11-10T10:37:35Z","isPatch":true,"sender":{"key":"elvanja@gmail.com","avatar":null},"body":"http://git.661346.n2.nabble.com/PATCH-Custom-prompt-colors-td7620939.html\n“Art has no limits.\nJust like me!”\nby Ponce\n\n\nOn Mon, Nov 10, 2014 at 10:42 AM, Vanja Radovanović <elvanja@gmail.com> wrote:\n> From 41e9edae533306b4a50570e32dbbdd291a4a5fbf Mon Sep 17 00:00:00 2001\n> From: =?UTF-8?q?Vanja=20Radovanovi=C4=87?= <elvanja@gmail.com>\n> Date: Sun, 9 Nov 2014 20:05:48 +0100\n> Subject: [PATCH] contrib/completion: custom git prompt colors\n>\n> Allow git prompt colors to be customized.\n> Accept globally set colors, use defaults otherwise.\n>\n> Note: requires /usr/lib/git-core/git-sh-promp to be\n> removed or commented out, so custom git-prompt.sh\n> can be used.\n> ---\n>  contrib/completion/git-prompt.sh | 18 +++++++++++++++++-\n>  1 file changed, 17 insertions(+), 1 deletion(-)\n>\n> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\n> index c5473dc..ff5b04b 100644\n> --- a/contrib/completion/git-prompt.sh\n> +++ b/contrib/completion/git-prompt.sh\n> @@ -84,6 +84,10 @@\n>  # GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on\n>  # the colored output of \"git status -sb\" and are available only when\n>  # using __git_ps1 for PROMPT_COMMAND or precmd.\n> +# Colors can be overridden; just set GIT_PS1_BAD_COLOR,\n> +# GIT_PS1_OK_COLOR and/or GIT_PS1_FLAGS_COLOR to the color of your choice.\n> +# Make sure you use appropriately escaped color codes, see\n> +# __git_ps1_colorize_gitstring function for details/defaults.\n>\n>  # check whether printf supports -v\n>  __git_printf_supports_v=\n> @@ -240,9 +244,21 @@ __git_ps1_colorize_gitstring ()\n>   local c_lblue='\\[\\e[1;34m\\]'\n>   local c_clear='\\[\\e[0m\\]'\n>   fi\n> +\n>   local bad_color=$c_red\n> +  if [ -n \"${GIT_PS1_BAD_COLOR-}\" ]; then\n> +    bad_color=$GIT_PS1_BAD_COLOR\n> +  fi\n> +\n>   local ok_color=$c_green\n> - local flags_color=\"$c_lblue\"\n> +  if [ -n \"${GIT_PS1_OK_COLOR-}\" ]; then\n> +    ok_color=$GIT_PS1_OK_COLOR\n> +  fi\n> +\n> +  local flags_color=\"$c_lblue\"\n> +  if [ -n \"${GIT_PS1_FLAGS_COLOR-}\" ]; then\n> +    flags_color=$GIT_PS1_FLAGS_COLOR\n> +  fi\n>\n>   local branch_color=\"\"\n>   if [ $detached = no ]; then\n> --\n> 2.1.3\n"}]}