From 49a642e5fd11133c880e5de8072a920c4e688cde Mon Sep 17 00:00:00 2001 From: Krayon Date: Mon, 13 Feb 2017 00:57:53 +1100 Subject: [PATCH 1/2] Fix last character having black background --- prompt.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/prompt.sh b/prompt.sh index 5390b58..836bef2 100644 --- a/prompt.sh +++ b/prompt.sh @@ -29,7 +29,6 @@ if [ -n "${BASH_VERSION}" ]; then : ${omg_default_color_on:='\[\033[1;37m\]'} : ${omg_default_color_off:='\[\033[0m\]'} - : ${omg_last_symbol_color:='\e[0;31m\e[40m'} PROMPT='$(build_prompt)' RPROMPT='%{$reset_color%}%T %{$fg_bold[white]%} %n@%m%{$reset_color%}' @@ -160,7 +159,7 @@ if [ -n "${BASH_VERSION}" ]; then fi fi prompt+=$(enrich_append ${is_on_a_tag} "${omg_is_on_a_tag_symbol} ${tag_at_current_commit}" "${black_on_red}") - prompt+="${omg_last_symbol_color}${reset}\n" + prompt+="${reset}${red}${reset}\n" prompt+="$(eval_prompt_callback_if_present)" prompt+="${omg_second_line}" else From 4556f33a0eb2be4d06a3e5a95073b3ce17c53293 Mon Sep 17 00:00:00 2001 From: Krayon Date: Wed, 12 Apr 2017 16:46:08 +1000 Subject: [PATCH 2/2] Remove last char manual fix documentation --- README.md | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/README.md b/README.md index 3316b43..04df4ab 100644 --- a/README.md +++ b/README.md @@ -169,46 +169,6 @@ Those are just default values. If you wish to use another glyph for untracked fi in your shell startup file. ---- -#### With Bash the last symbol looks very bad, like this - -![oh-my-git](https://cloud.githubusercontent.com/assets/6009528/6031476/0b9bfe2c-ac00-11e4-898a-324a71be6cb5.png) - -**A**: Unfortunately, I haven't find a way to tell bash "*print the next symbol using the background color currently used by the terminal*" and as far as I know [there's no way to achieve this result](http://unix.stackexchange.com/questions/1755/change-the-ps1-color-based-on-the-background-color#tab-top). Zsh is not affected by this issue, but bash is. - -As a consequence, when printing the last symbol, oh-my-git has no choice but setting explicitly the foreground and background colors. Currently, the standard background color is black. This is unfortunate, because if the terminal uses a different background color than black, the result is bad, as showed in the above screenshot. - -A smart solution is the one proposed by [@Sgiath](https://github.com/Sgiath): in the color palette set the first color (the one in the top-left corner) same as background color, like this - -![oh-my-git](https://cloud.githubusercontent.com/assets/6009528/6039646/454c965e-ac69-11e4-8f80-37425181d04b.png) - -This in fact sets the "black" color to the same color used as the terminal background. - - -If for any reasons you cannot change the palette, you can override the colors used to render the last symbol with the variable `omg_last_symbol_color`. - -For example, if the terminal is using a gray background, you can add a - -``` -background=240 -red='\e[0;31m' -omg_last_symbol_color="${red}\[\033[48;5;${background}m\]" -``` - -to your `.bashrc` and fix the issue by choosing the right value for `background`. - -You can use - -``` -foreground=160 -background=240 -omg_last_symbol_color="\[\033[38;5;${foreground}m\]\[\033[48;5;${background}m\]" -``` - -if you want a more detailed control on the colors. - -Finding the right value is not trivial. Please, refer to [this page](http://bitmote.com/index.php?post/2012/11/19/Using-ANSI-Color-Codes-to-Colorize-Your-Bash-Prompt-on-Linux) for a the 256 colors code table. - --- #### On OS X, I configured iTerm2 with the patched font, but the prompt is still broken.