Firstly the base grayscale map to sample the gradient texture with parameters to remap the channel value and allow to invert the map achieving a different silhouettes compared to texture's initial look.
Alpha blended the output since it's premultiply!
We sample a ramp texture, Y/V set to "0" because I'm sampling the gradient left to right, with the most left pixel the darkest while the most right pixel the brightest from previous texture sample! (Also, forced / hardcoded sample state to clamp)
You may use any software to create such texture, however, I've used this plugin available on github to speedup my work https://github.com/rstecca/ColorBands