Hah, what a coincidence. I did small research today for heatmaps for my very simply graph lib for Ruby. I recommend this blog post:
https://research.google/blog/turbo-an-improved-rainbow-color...
I myself implemented 4 colorize functions for that. Common linear Blue -> Red. Linear Blue -> Red adjusted via Green for visibility. Blue -> Yellow -> Red also linear. And of course Turbo from that blog..