Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predictable ID colours in blame view #303

Closed
commonquail opened this issue Jun 13, 2014 · 1 comment
Closed

Predictable ID colours in blame view #303

commonquail opened this issue Jun 13, 2014 · 1 comment

Comments

@commonquail
Copy link

Right now the ID colours in the blame view are not predictable. I find this to be very confusing and a huge distraction when navigating through history. The colours don't need to be permanently consistent or even necessarily within the same tig session, but they shouldn't change as long as you stay in the blame view. The Irssi nick colouring algorithm could be one way to do this, but I have no idea how well that would integrate.

my @colors = qw/2 3 4 5 6 7 9 10 11 12 13/;

sub simple_hash {
  my ($string) = @_;
  chomp $string;
  my @chars = split //, $string;
  my $counter;

  foreach my $char (@chars) {
    $counter += ord $char;
  }

  $counter = $colors[$counter % 11];

  return $counter;
}
@jonas
Copy link
Owner

jonas commented Jun 18, 2014

This has been addressed in commit 0ebb9a4. It does not guarantee that colors are different for neighboring commits in the blame view, but that would not be possible anyway if commit IDs must be stable and predictable.

@jonas jonas closed this as completed Jun 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants