fillStyle
by aio350
HTML
<canvas width="300" height="300" style="border: 1px dotted #222"></canvas>
CSS
body {
margin: 0;
height: 100vh;
background: radial-gradient(circle, skyblue, steelblue);
display: flex;
justify-content: center;
align-items: center;
}
JavaScript
const canvas = document.querySelector('canvas')
const $ = canvas.getContext('2d')
for (let i = 0; i < 6; i++) {
for (let j = 0; j < 6; j++) {
$.fillStyle = `rgb(${Math.floor(255 - 42.5 * i)}, ${Math.floor(255 - 42.5 * j)}, 0`
$.fillRect(j * 50, i * 50, 50, 50)
}
}