Skip to content

Commit

Permalink
feat: make text gray
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoDog896 committed Jul 14, 2023
1 parent e0674be commit 500e2d4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,21 @@
const xPos = i * boxSize + (x % boxSize);
const yPos = j * boxSize + (y % boxSize);
if (map[JSON.stringify([xCoord, yCoord])]) {
const activeCell = map[JSON.stringify([xCoord, yCoord])];
if (activeCell) {
context.fillStyle = 'black';
context.fillRect(xPos, yPos, boxSize, boxSize);
} else {
context.fillStyle = 'white';
context.strokeStyle = 'gray';
context.strokeRect(xPos, yPos, boxSize, boxSize);
}
// draw the coords
console.log(boxSize)
if (boxSize > 35) {
context.fillStyle = map[JSON.stringify([xCoord, yCoord])] ? 'white' : 'black';
context.fillStyle = activeCell ? 'white' : 'gray';
context.font = `${boxSize / 2}px`;
context.fillText(`${xCoord}, ${yCoord}`, xPos + 5, yPos + 15);
}
Expand Down

0 comments on commit 500e2d4

Please sign in to comment.