2026-10-20 16:33:05 +08:00
|
|
|
import { useLayoutEffect } from "react";
|
|
|
|
|
|
|
|
|
|
import { useLocalPreferences } from "@/hooks/useLocalPreferences";
|
|
|
|
|
|
|
|
|
|
/** Project browser preferences onto text tokens, without scaling the UI or rem. */
|
|
|
|
|
export function useReadingTypography(): void {
|
2026-10-25 21:12:41 +08:00
|
|
|
const { readingTextSize, customReadingTextSize } = useLocalPreferences();
|
2026-10-20 16:33:05 +08:00
|
|
|
useLayoutEffect(() => {
|
|
|
|
|
document.documentElement.dataset.readingTextSize = readingTextSize;
|
2026-10-25 21:12:41 +08:00
|
|
|
document.documentElement.style.setProperty("--custom-reading-size", `${customReadingTextSize}px`);
|
|
|
|
|
}, [readingTextSize, customReadingTextSize]);
|
2026-10-20 16:33:05 +08:00
|
|
|
}
|