Skip to content

Commit 0acd8c1

Browse files
committed
fix: add monospace rule
1 parent 922f7c3 commit 0acd8c1

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

assets/favicon.ico

-14.9 KB
Binary file not shown.

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<script type="text/javascript" src="./scripts/main.js" defer></script>
77

88
<head>
9-
<title>NEI/AAC</title>
9+
<title>🏗️🚧</title>
1010
<meta charset="utf-8" />
1111
<meta name="viewport" content="width=device-width, initial-scale=1" />
1212
<meta name="description" content="Website under development." />

scripts/main.js

+13-7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ window.addEventListener("load", main, false);
2626

2727
function drawCanvas(canvas, ctx) {
2828
const { currentColorIndex, bgColors } = state;
29+
ctx.font = "24px monospace";
2930
ctx.fillStyle = `rgba(${bgColors[currentColorIndex].join(", ")}, 1)`;
3031
ctx.fillRect(0, 0, canvas.width, canvas.height);
3132

@@ -42,7 +43,7 @@ function resizeCanvas(canvas, ctx) {
4243
function drawLines(canvas, ctx) {
4344
const { currentColorIndex, txtColors } = state;
4445
const margin = canvas.height / 20;
45-
const stroke = (canvas.height * canvas.width) / 400000;
46+
const stroke = 2;
4647

4748
ctx.fillStyle = `rgba(${txtColors[currentColorIndex].join(", ")}, 1)`;
4849

@@ -60,13 +61,18 @@ function drawText(canvas, ctx) {
6061
const margin = canvas.height / 20;
6162

6263
const year = new Date().getFullYear();
63-
const text = `© ${year} NEI/AAC`;
64-
const size = window.innerWidth < 500 ? 20 : 25;
65-
ctx.font = `${size}px Satoshi Bold`;
64+
const first = `${year}`;
65+
const second = `NEI/AAC`;
66+
6667
ctx.textAlign = "start";
6768
ctx.textBaseline = "bottom";
6869

69-
ctx.fillText(text, margin + margin / 2, canvas.height - (1.5 * margin));
70+
ctx.fillText(first, margin * 1.5, canvas.height - margin * 1.5);
71+
72+
ctx.textAlign = "end";
73+
ctx.textBaseline = "top";
74+
75+
ctx.fillText(second, canvas.width - margin * 1.5, margin * 1.5);
7076
}
7177

7278
async function fadeCanvas(canvas, ctx) {
@@ -98,8 +104,8 @@ function main() {
98104

99105
const font = new FontFace("Satoshi Bold", "url(./assets/fonts/satoshi-bold.otf)");
100106

101-
font.load().then((loadedFont) => {
102-
document.fonts.add(loadedFont);
107+
font.load().then((loaded) => {
108+
document.fonts.add(loaded);
103109
drawCanvas(canvas, ctx);
104110
resizeCanvas(canvas, ctx);
105111
fadeCanvas(canvas, ctx);

styles/globals.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
body {
2-
width: 100vw;
3-
height: 100vh;
2+
width: 100dvw;
3+
height: 100dvh;
44
margin: 0;
55
border: 0;
66
overflow: hidden;

0 commit comments

Comments
 (0)