// "Solid backgrounds" — a gear-menu toggle that turns the frosted, see-through // surfaces opaque (mara: "add setting to disable transparency", e.g. the top // bar and badge backgrounds). Off by default, so the look is unchanged until // someone turns it on. // // The setting sets `data-solid="true"` on ``, and `./solid-backgrounds.css` // answers it. The caller owns the storage key, as with the theme and motion // overrides, and mounts `useApplySolidBackgrounds` once so the choice applies // before the menu is ever opened; `SolidBackgroundsSetting` is the menu's row. import { useEffect } from "preact/hooks"; import { useLocalSetting } from "./settings-storage.js"; import "./solid-backgrounds.css"; export function useApplySolidBackgrounds(key: string): void { const [solid] = useLocalSetting(key, false); useEffect(() => { const root = document.documentElement; if (solid) root.dataset.solid = "true"; else delete root.dataset.solid; }, [solid]); } export function SolidBackgroundsSetting({ storageKey, }: { storageKey: string; }) { const [solid, setSolid] = useLocalSetting(storageKey, false); return ( ); }