I have a HTML5 canvas on which I have drawn a full fledged table. I have the option to give a background color to the table headers. Although normal background color works, I am unable to apply the linear gradient correctly. I get the linear gradient in this format
background: linear-gradient(55deg, rgb(0, 0, 0) 0%, rgb(128, 0, 128) 50%, rgb(255, 0, 0) 100%);
I have used this available solution, but it doesn't seem to work in all cases. I need to know how to exactly calculate the end points of the gradient line since the canvas linearGradient() expects it that way.