Dark Mode
PHPXUI supports dark mode out of the box by toggling the dark class on the
<html> tag. Prisma PHP has no server-readable client store, so the browser hands the choice
back to PHP through a cookie that the root layout reads before the first paint.
1. Read the theme on the server
Add a small helper under src/Lib so every route reads the theme the same way. Prisma PHP no longer
exposes Request::$localStorage, so the value comes from the request cookies:
2. Configure src/app/layout.php
Apply the stored theme to the document element so the first render already matches the visitor's choice:
3. Add a theme toggle
The toggle lives in an imported partial so it keeps its own PulsePoint boundary. Write the cookie from the
click handler — that is what Lib\Theme::current() reads on the next server render.
Render it from a route or layout with ImportComponent:
Keep the <script> inside the partial's single root element and leave it untyped — the
PulsePoint runtime only picks up component scripts with no type attribute.
4. Customize Dark Mode Colors
Open your stylesheet at src/app/globals.css and edit the .dark block: