[go: up one dir, main page]

Skip to content

Instantly share code, notes, and snippets.

@BuonOmo
Last active August 21, 2024 12:14
Show Gist options
  • Save BuonOmo/ce45b51d0cefe949fd0c536a4a60f000 to your computer and use it in GitHub Desktop.
Save BuonOmo/ce45b51d0cefe949fd0c536a4a60f000 to your computer and use it in GitHub Desktop.
Git blame color scale from 20 month ago to now (https://stackoverflow.com/a/66250482/6320039)
[color "blame"]
highlightRecent = 234, 23 month ago, 235, 22 month ago, 236, 21 month ago, 237, 20 month ago, 238, 19 month ago, 239, 18 month ago, 240, 17 month ago, 241, 16 month ago, 242, 15 month ago, 243, 14 month ago, 244, 13 month ago, 245, 12 month ago, 246, 11 month ago, 247, 10 month ago, 248, 9 month ago, 249, 8 month ago, 250, 7 month ago, 251, 6 month ago, 252, 5 month ago, 253, 4 month ago, 254, 3 month ago, 231, 2 month ago, 230, 1 month ago, 229, 3 weeks ago, 228, 2 weeks ago, 227, 1 week ago, 226
[blame]
coloring = highlightRecent
date = human
@brandon1024
Copy link

This is suuuuper nice. I'm surprised I hadn't noticed that this coloring feature existed, this is brilliant.

Fading to yellow is nice, but I think fading to green would have been a better choice IMO. For me, yellow indicates warning, green indicates good or fresh. Thanks for the inspiration!

@BuonOmo
Copy link
Author
BuonOmo commented Jul 31, 2024

@brandon1024 that would be nice in green indeed ! Unfortunately, yellow was the only ANSI color I could easily make a nice gradient with. If you find another one, please share it here :)

Here's the code for the ANSI color palette:

# Print out color for each code in ANSI range
for code in {0..255}; do
  printf "\e[38;5;${code}m%03d\e[0m " $code
  if (( 0 == (code + 1) % 16 )); then
	echo
  fi
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment