diff --git a/index.html b/index.html index e22c291..19c498b 100644 --- a/index.html +++ b/index.html @@ -1,14 +1,88 @@ - + Homepage + -
-

Willkommen!

-
+
+ +
+
+

Hi, I'm Lars.

+
+

My Projects:

+
+

Turtle Game

+

+ nom +

+
+
+

Minecraft Tetris clone

+

+ I love playing Minecraft and Tetris, so I made a Tetris clone in Minecraft. +

+
+
+

Gitea

+

+ My own git server where I store my projects. +

+
+
+

Mathemann

+

+ This Mathemann website was a school project. +

+
+
+
+ diff --git a/script.js b/script.js new file mode 100644 index 0000000..6f8934f --- /dev/null +++ b/script.js @@ -0,0 +1,20 @@ +const themeButton = document.getElementById("theme-toggle"); +const root = document.documentElement; + +themeButton.addEventListener("click", () => { + const currentTheme = getCurrentTheme(); + + if (currentTheme === "light") { + root.dataset.theme = "dark"; + return; + } + root.dataset.theme = "light"; +}); + +function getCurrentTheme() { + const selectedTheme = root.dataset.theme; + + if (selectedTheme !== undefined) return selectedTheme; + if(window.matchMedia("(prefers-color-scheme: dark)").matches) return "dark"; + return "light"; +} diff --git a/style.css b/style.css index 2e7c620..82b026a 100644 --- a/style.css +++ b/style.css @@ -1,3 +1,93 @@ +* { + box-sizing: border-box; +} + +body { + background-color: var(--color-background); + color: var(--color-text); + font-family: "Roboto", sans-serif; + margin: 0; +} + +.nav-bar ul { + list-style-type: none; + display: flex; + width: 100%; + justify-content: space-evenly; + align-items: center; + padding: 0; + margin: 10px 0; +} + +.nav-bar a, +.nav-bar button { + color: inherit; + font: inherit; + background: none; + border: none; + text-decoration: none; + padding: 5px; + cursor: pointer; + display: inline-flex; + align-items: center; + gap: 0.4rem; +} + +.nav-bar svg { + width: 1em; + height: 1em; + flex-shrink: 0; +} + +.nav-bar button:hover, +.nav-bar a:hover { + color: var(--color-link-hover); +} + +nav { + border-bottom: 1px solid var(--color-border); +} + +main { + max-width: 1000px; + margin: 0 auto; + padding: 24px; +} + +.project-card { + padding: 0 10px; + margin: 5px 0; + border: 2px solid var(--color-border); + border-radius: 10px; + background-color: var(--color-card); +} + +footer { + display: flex; + justify-content: center; + padding-top: 5px; + background-color: cornflowerblue; + color: black; +} + +:root { + color-scheme: dark light; + + --color-background: light-dark(#eeeeee, #222222); + --color-text: light-dark(#222222, #eeeeee); + --color-link-hover: light-dark(#676767, #bababa); + --color-border: light-dark(#888888, #888888); + --color-card: light-dark(#dadada, #313131); +} + +:root[data-theme="light"] { + color-scheme: light; +} + +:root[data-theme="dark"] { + color-scheme: dark; +} + @font-face { font-display: swap; font-family: 'Fredoka'; @@ -22,7 +112,6 @@ src: url('assets/fonts/fredoka-v17-latin_latin-ext-700.woff2') format('woff2'); } - @font-face { font-display: swap; font-family: 'Roboto'; @@ -46,12 +135,3 @@ font-weight: 700; src: url('assets/fonts/roboto-700.woff2') format('woff2'); } - -body { - background-color: #222222; - font-family: "Roboto"; -} - -h1 { - color: #eeeeee; -}