From 4d03b47d97bae4bcfe1c2084b2ac26458e6e678d Mon Sep 17 00:00:00 2001 From: Adam Iannazzone <46025473+jiannazzone@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:11:44 -0400 Subject: [PATCH] Add accesibility toggle for pixel fonts --- css/style.css | 1 + index.html | 3 ++- scripts/accessibility.js | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 scripts/accessibility.js diff --git a/css/style.css b/css/style.css index 250e9dd..15ad16e 100644 --- a/css/style.css +++ b/css/style.css @@ -1,4 +1,5 @@ @import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css"); +@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap'); @font-face { font-family: "Upheaval TT"; src: url("../assets/fonts/upheavtt.ttf"); diff --git a/index.html b/index.html index ced5dde..706f8e7 100644 --- a/index.html +++ b/index.html @@ -248,7 +248,8 @@ integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"> - + + \ No newline at end of file diff --git a/scripts/accessibility.js b/scripts/accessibility.js new file mode 100644 index 0000000..a89f0cd --- /dev/null +++ b/scripts/accessibility.js @@ -0,0 +1,10 @@ +function pixelFontToggle() { + const pixelFontDefault = "\"Upheaval TT\", monospace;" + + const pixelFontSwitchElem = document.getElementById("pixel-font-switch"); + if (pixelFontSwitchElem.checked) { + document.documentElement.style.cssText = "--pixel-font: \"Upheaval TT\", monospace"; + } else { + document.documentElement.style.cssText = "--pixel-font: \"Source Sans 3\", sans-serif"; + } +} \ No newline at end of file