JSFiddle - React, Tailwind, and code Playground
by Will Stott
HTML
<canvas width="512" height="256"></canvas>
JavaScript
const canvas = document.getElementsByTagName("canvas")[0];
const ctx = canvas.getContext("2d");
const grad = ctx.createLinearGradient(256, 0, 256, 512);
grad.addColorStop(0,"lightblue");
grad.addColorStop(1, "blue");
ctx.fillStyle = grad;
ctx.fillRect(0, 0, 512, 256);