Added high-contrast mode, close button, dyslexia tweaks.
This commit is contained in:
parent
dbf0683b22
commit
0b05878666
4 changed files with 67 additions and 5 deletions
|
|
@ -45,9 +45,9 @@ const base = import.meta.env.BASE_URL;
|
|||
<input type="radio" class="button" name="mode" value="hc" id="af-hc">
|
||||
<label for="af-hc" class="button">High Contrast</label>
|
||||
</fieldset>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
<div class="text-right"><button class="close">Close</button></div>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
|
|
|
|||
|
|
@ -107,8 +107,14 @@ class ThemeToggler {
|
|||
if (localStorage.af_enabled === '1') {
|
||||
if (localStorage.af_mode === 'df') {
|
||||
ele.classList.remove('dark');
|
||||
ele.classList.remove('hc');
|
||||
ele.classList.add('df');
|
||||
}
|
||||
if (localStorage.af_mode === 'hc') {
|
||||
ele.classList.remove('dark');
|
||||
ele.classList.remove('df');
|
||||
ele.classList.add('hc');
|
||||
}
|
||||
return;
|
||||
}
|
||||
switch (localStorage.theme) {
|
||||
|
|
|
|||
|
|
@ -48,6 +48,11 @@ html.df {
|
|||
--reading-text: #1e1e1e;
|
||||
}
|
||||
|
||||
html.hc {
|
||||
--reading-bg: #fff;
|
||||
--reading-text: #000;
|
||||
}
|
||||
|
||||
html.df .study-notes :is(em, i, blockquote) {
|
||||
font-style: normal;
|
||||
}
|
||||
|
|
@ -58,11 +63,17 @@ html.df .study-notes :is(em, i) {
|
|||
@apply underline-offset-4;
|
||||
}
|
||||
|
||||
html.df body {
|
||||
html.df body, html.hc body {
|
||||
background-color: var(--reading-bg);
|
||||
}
|
||||
|
||||
html.df article.content.study-notes {
|
||||
.header {
|
||||
@apply bg-transparent rounded-none bg-none border-b-4 border-b-neutral-500;
|
||||
}
|
||||
section time, section ul.tags {
|
||||
color: var(--reading-text);
|
||||
}
|
||||
a.scripture {
|
||||
text-underline-offset: 10px;
|
||||
}
|
||||
|
|
@ -109,6 +120,33 @@ html.df article.content.study-notes {
|
|||
}
|
||||
}
|
||||
|
||||
html.hc article.content.study-notes {
|
||||
.header {
|
||||
@apply bg-transparent border-dotted rounded-none bg-none border-4 border-b-black;
|
||||
}
|
||||
section time, section ul.tags {
|
||||
@apply text-black;
|
||||
}
|
||||
a, a.scripture {
|
||||
@apply decoration-neutral-800;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
@apply border-l-gray-800 text-black;
|
||||
}
|
||||
|
||||
blockquote a {
|
||||
@apply text-black;
|
||||
}
|
||||
|
||||
a.scripture.quote, a.scripture.christ {
|
||||
@apply bg-transparent decoration-0;
|
||||
}
|
||||
a.scripture.christ {
|
||||
@apply text-red-900;
|
||||
}
|
||||
}
|
||||
|
||||
@utility study-notes {
|
||||
font-family: var(--reading-font-family);
|
||||
background-color: var(--reading-bg);
|
||||
|
|
@ -323,7 +361,7 @@ dialog.config {
|
|||
}
|
||||
|
||||
legend {
|
||||
@apply text-sm;
|
||||
@apply text-lg;
|
||||
}
|
||||
|
||||
input.button[type=radio] {
|
||||
|
|
@ -357,12 +395,17 @@ dialog.config {
|
|||
@apply text-blue-300 bg-blue-800;
|
||||
}
|
||||
|
||||
button.close {
|
||||
@apply border border-gray-800 bg-neutral-200 hover:bg-rose-800 hover:text-white rounded-sm pl-2 pr-2 pt-1 pb-1 m-2 mt-10 text-lg cursor-pointer;
|
||||
@apply dark:bg-neutral-800 dark:text-neutral-200;
|
||||
}
|
||||
|
||||
.content {
|
||||
@apply p-4;
|
||||
}
|
||||
|
||||
h1 {
|
||||
@apply font-bold text-xl mb-2 underline underline-offset-4;
|
||||
@apply font-bold text-xl mb-4 underline underline-offset-4;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ export const bindConfig = () => {
|
|||
input.addEventListener('change', (evt) => {
|
||||
if (evt.target.value === 'dyslexia') {
|
||||
document.documentElement.classList.remove('dark');
|
||||
document.documentElement.classList.remove('hc');
|
||||
document.documentElement.classList.add('df');
|
||||
// Set accessibility features.
|
||||
localStorage.af_enabled = 1;
|
||||
|
|
@ -35,9 +36,21 @@ export const bindConfig = () => {
|
|||
document.documentElement.classList.remove('df');
|
||||
document.documentElement.classList.remove('hc');
|
||||
localStorage.af_enabled = 0;
|
||||
} else if (evt.target.value === 'hc') {
|
||||
document.documentElement.classList.remove('df');
|
||||
document.documentElement.classList.remove('dark');
|
||||
document.documentElement.classList.add('hc');
|
||||
localStorage.af_enabled = 1;
|
||||
localStorage.af_mode = 'hc';
|
||||
}
|
||||
});
|
||||
});
|
||||
dialog.querySelectorAll('button.close').forEach((btn) => {
|
||||
btn.addEventListener('click', (evt) => {
|
||||
evt.preventDefault();
|
||||
dialog.close();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue