Workshop › Minesweeper › Step 10 of 26
An open cell is drawn light grey, a hidden one stays darker grey.
```js
if (cell.revealed) {
ctx.fillStyle = '#e2e8f0'
ctx.fillRect(x + 1, y + 1, CELL - 2, CELL - 2)
} else {
ctx.fillStyle = '#94a3b8'
ctx.fillRect(x + 1, y + 1, CELL - 2, CELL - 2)
}
```if ... else draws one of two squares: light for an open cell, the old grey otherwise.In draw, inside the for loop, wrap the two square lines in if (cell.revealed) { ... } else { ... } as shown.
Skills: Drawing on a canvas
← Open a cell Coloured numbers →