Skip to content

Commit 15c702b

Browse files
Use the defaults in diff-highlight if nothing is set in the git config
1 parent 5c4da1c commit 15c702b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

diff-so-fancy

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,12 +1066,13 @@ sub yes_no {
10661066
}
10671067
}
10681068

1069+
# If there are colors set in the gitconfig use those, otherwise leave the defaults
10691070
sub init_diff_highlight_colors {
1070-
$DiffHighlight::NEW_HIGHLIGHT[0] = git_ansi_color(git_config('color.diff-highlight.newnormal')) || color("2_bold");
1071-
$DiffHighlight::NEW_HIGHLIGHT[1] = git_ansi_color(git_config('color.diff-highlight.newhighlight')) || color("2_bold") . color("on_22");
1071+
$DiffHighlight::NEW_HIGHLIGHT[0] = git_ansi_color(git_config('color.diff-highlight.newnormal')) || $DiffHighlight::NEW_HIGHLIGHT[0];
1072+
$DiffHighlight::NEW_HIGHLIGHT[1] = git_ansi_color(git_config('color.diff-highlight.newhighlight')) || $DiffHighlight::NEW_HIGHLIGHT[1];
10721073

1073-
$DiffHighlight::OLD_HIGHLIGHT[0] = git_ansi_color(git_config('color.diff-highlight.oldnormal')) || color("1_bold");
1074-
$DiffHighlight::OLD_HIGHLIGHT[1] = git_ansi_color(git_config('color.diff-highlight.oldhighlight')) || color("1_bold") . color("on_52");
1074+
$DiffHighlight::OLD_HIGHLIGHT[0] = git_ansi_color(git_config('color.diff-highlight.oldnormal')) || $DiffHighlight::OLD_HIGHLIGHT[0];
1075+
$DiffHighlight::OLD_HIGHLIGHT[1] = git_ansi_color(git_config('color.diff-highlight.oldhighlight')) || $DiffHighlight::OLD_HIGHLIGHT[1];
10751076
}
10761077

10771078
# vim: tabstop=4 shiftwidth=4 noexpandtab autoindent softtabstop=4

0 commit comments

Comments
 (0)