In Ps, I want to design a gradient with two color which they are only different with brightness,pls see below:

This type of gradient can be made by separating two layers which the top layer is blended with Luminosity.
I am trying to use ajax to generate the gradient which I only need to send the color value to php ,then the color and the overlay png will be composed to output a result png.
My english is poor, it is hard for me to describe a probem clearly, sorry for that.