import type * as getBrand from '#lib/lexicons/org/atgrp/internal/getBrand.ts'; import type { LayoutServerLoad } from './$types'; import { appearanceOf, COOKIE } from '#lib/appearance.ts'; import { paletteOf, UNBRANDED } from '#lib/brand.ts'; import { xrpc } from '#lib/data.ts'; /** * Whether the reader chose light or dark, by their cookie: as their * system has it, if not. And how the host shows itself, its name, logo * and links: the console's own, from a host that does not say. Its * palette is the page's from its first byte (`hooks.server.ts`), so the * page never flashes the console's own. */ export const load: LayoutServerLoad = async (event) => { const brand = await xrpc(event, 'org.atgrp.internal.getBrand', {}).catch( () => UNBRANDED ); event.locals.palette = paletteOf(brand); return { appearance: appearanceOf(event.cookies.get(COOKIE)), brand }; };