diff --git a/src/App.svelte b/src/App.svelte index c137f34d..fde28df5 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -12,6 +12,7 @@ import Group from './pages/Group.svelte'; import { Alert } from 'sveltestrap'; import DiscordLogin from "./pages/DiscordLogin.svelte"; + import { onMount } from 'svelte'; // theme cdns (I might make some myself too) let light = "https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css"; @@ -43,6 +44,15 @@ import DiscordLogin from "./pages/DiscordLogin.svelte"; }; let falseBool = false; + + onMount(() => { + let settings = JSON.parse(localStorage.getItem("pk-settings")); + + if (settings && settings.accessibility.opendyslexic === true) { + document.getElementById("app").classList.add("dyslexic"); + } + }); + diff --git a/src/pages/Settings.svelte b/src/pages/Settings.svelte index 2dbf1a4b..9ba1dfd2 100644 --- a/src/pages/Settings.svelte +++ b/src/pages/Settings.svelte @@ -12,6 +12,9 @@ gradient_background: false, color_background: false, twemoji: false + }, + accessibility: { + opendyslexic: false } }; @@ -19,6 +22,11 @@ settings = {...settings, ...savedSettings} }; + function toggleOpenDyslexic() { + if (settings.accessibility.opendyslexic) document.getElementById("app").classList.add("dyslexic"); + else document.getElementById("app").classList.remove("dyslexic"); + } + @@ -54,6 +62,14 @@ If enabled, turns the background on member pages into the member's color. +

Accessibility

+
+ + + Use the opendyslexic font? {settings.accessibility.opendyslexic = !settings.accessibility.opendyslexic; localStorage.setItem("pk-settings", JSON.stringify(settings)); toggleOpenDyslexic();}}/> + If enabled, shows banners from the top of the system, member and group pages. + + diff --git a/styles/generic.scss b/styles/generic.scss index 356c067b..14308b52 100644 --- a/styles/generic.scss +++ b/styles/generic.scss @@ -3,6 +3,7 @@ This stylesheet should be used globally regardless of theming some specific rules are meant to be overwritten by the individual themes */ +@import url('http://fonts.cdnfonts.com/css/open-dyslexic'); // some variables $breakpoint-xs: 0px; @@ -31,6 +32,10 @@ code { color: var(--bs-body-color) !important; // overwrite } +.dyslexic { + font-family: 'Open-Dyslexic', sans-serif; +} + // pk-webs specific elements .icon { height: 1.5em;