- Reading mode is now a reader view (ReaderView.tsx): the page renders hidden and its headings, paragraphs, links and described pictures are written out in one column, with no header, backdrop or footer. - Color blind modes swap all three color families (teal, green, amber); palette hexes in components and CSS are now var(--pal-<family>-<shade>) so the modes reach them. - CLAUDE.md and docs/updating-data-in-code.md describe both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
15 lines
651 B
TypeScript
15 lines
651 B
TypeScript
/* Whether the accessibility panel's reading mode is on: <html
|
|
data-reading="on">, set before the first paint (index.html) and by
|
|
the panel. A hook, so the layout redraws the moment it changes. */
|
|
|
|
import { useSyncExternalStore } from 'react'
|
|
|
|
const read = () => document.documentElement.dataset.reading === 'on'
|
|
|
|
function subscribe(onChange: () => void) {
|
|
const observer = new MutationObserver(onChange)
|
|
observer.observe(document.documentElement, { attributes: true, attributeFilter: ['data-reading'] })
|
|
return () => observer.disconnect()
|
|
}
|
|
|
|
export const useReadingMode = (): boolean => useSyncExternalStore(subscribe, read, () => false)
|