git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: nathdwek <nathdwek@ulb.ac.be>
To: git@vger.kernel.org
Subject: __git_ps1_colorize__gitstring() in git_prompt.sh: colors are hardcoded?
Date: Fri, 17 Oct 2014 19:30:52 +0200	[thread overview]
Message-ID: <5441524C.6040302@ulb.ac.be> (raw)

Hello,

It seems to me that the colors used to indicate the repo's state in the
prompt are hardcoded although the top comment says otherwise.

>From contrib/completion/git-contrib.sh:

[83]# If you would like a colored hint about the current dirty state, set
# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
# the colored output of "git status -sb" and are available only when
# using __git_ps1 for PROMPT_COMMAND or precmd.

[228]__git_ps1_colorize_gitstring ()
{
	if [[ -n ${ZSH_VERSION-} ]]; then
		local c_red='%F{red}'
		local c_green='%F{green}'
		local c_lblue='%F{blue}'
		local c_clear='%f'
	else
		# Using \[ and \] around colors is necessary to prevent
		# issues with command line editing/browsing/completion!
		local c_red='\[\e[31m\]'
		local c_green='\[\e[32m\]'
		local c_lblue='\[\e[1;34m\]'
		local c_clear='\[\e[0m\]'
	fi
	local bad_color=$c_red
	local ok_color=$c_green
	local flags_color="$c_lblue"

	local branch_color=""


As expected upon seeing this snippet, the color.status.<slot> entries in
the git config file do modify the git status -sb output but don't modify
the colors used in the prompt.

Regards,

Nathan

             reply	other threads:[~2014-10-17 17:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-17 17:30 nathdwek [this message]
2014-10-20 14:45 ` __git_ps1_colorize__gitstring() in git_prompt.sh: colors are hardcoded? Michael J Gruber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5441524C.6040302@ulb.ac.be \
    --to=nathdwek@ulb.ac.be \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).