Skip to content

Commit 9ffbbb9

Browse files
Make some color logic consistent
1 parent 4bd14c3 commit 9ffbbb9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

diff-so-fancy

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ my $git_strip_prefix = git_config_boolean("diff.noprefix","false");
2626
my $has_stdin = has_stdin();
2727

2828
my $ansi_color_regex = qr/(\e\[([0-9]{1,3}(;[0-9]{1,3}){0,3})[mK])?/;
29-
my $dim_magenta = "\e[38;5;146m";
30-
my $reset_color = "\e[0m";
31-
my $bold = "\e[1m";
29+
my $reset_color = color("reset");
30+
my $bold = color("bold");
3231
my $meta_color = "";
3332

3433
my ($file_1,$file_2);
@@ -247,7 +246,10 @@ sub do_dsf_stuff {
247246

248247
# Figure out the start line
249248
my $start_line = start_line_calc($new_offset,$new_count);
250-
print "@ $last_file_seen:$start_line \@${bold}${dim_magenta}${remain}${reset_color}\n";
249+
250+
# Last function has it's own color
251+
my $last_function_color = get_config_color("last_function");
252+
print "@ $last_file_seen:$start_line \@${bold}${last_function_color}${remain}${reset_color}\n";
251253
###################################
252254
# Remove any new file permissions #
253255
###################################
@@ -806,6 +808,8 @@ sub color {
806808
} elsif ($str eq "remove_line") {
807809
# Default ANSI red
808810
$ret = DiffHighlight::color_config('color.diff.old', color('bold') . color(1));
811+
} elsif ($str eq "last_function") {
812+
$ret = color(146);
809813
}
810814

811815
# Cache (memoize) the entry for later

0 commit comments

Comments
 (0)