Repository source: docs/agents/image_to_theme.md
Image to theme
Turn a picture someone likes into a new ZenMemes theme. Use this when someone gives you an image (a screenshot, a Pinterest pin, a photo, a poster) and asks for a theme that looks like it.
This is the shortest path to personal themes: no upload feature, no generator. The person hands an agent the image and this repository, and the agent builds an ordinary theme and opens a pull request. It works with any coding agent that can read images, run commands and open a PR.
For the person asking
Give your agent three things:
The image, attached to the chat.
The repository:
https://github.com/gulkily/v3(or your fork).One line, for example: "Make a ZenMemes theme from this image, following docs/agents/image_to_theme.md."
Optional: a name for the theme, whether it should be light or dark, and anything in the picture you especially want kept, such as a font, a texture or one colour.
You get back a pull request with screenshots of the new theme next to your image. The theme stays off until an operator turns on its flag.
For the agent
Every committed change runs as a Railspike cycle (see AGENTS.md). A clear "make a theme from this image" request is enough authority for a one-shot cycle through an open PR. It does not authorize merging, deploying or turning the flag on in production.
1. Read the image
Look at the image before anything else and write down, in the cycle record:
Palette: five to eight colours with hex values, each with a role: page background, panel, ink, muted ink, accent, link, border. Sample them from the image; don't guess from memory of the source.
Mode: light or dark, from the page background you chose.
Type: the feel of any lettering (serif, grotesk, handwritten, monospace, pixel). Use system or already-used font stacks; a new web font is a third-party dependency and needs the maintainer's approval (
CONTRIBUTING.md).Texture and shape: grain, gradients, rounded or square corners, heavy or hairline borders, shadows, any repeating motif.
What makes it this picture: the one or two things someone would recognise. Build those first.
If the image is unclear (a busy photo, two competing styles), pick the reading the person most likely meant and say so in the PR. Ask only when the answer would change the theme a lot, such as light versus dark.
2. Build the theme
Follow docs/runbooks/theme_development_guide.md. In short:
Add an entry to
src/ForumRewrite/View/ThemeRegistry.phpwith a short lowercasename, alabeland amode.Put it behind its own flag, off by default and site-mutable, as Zalgo and Vaporgeist do: add
FORUM_<NAME>_THEME_ENABLEDtoFeatureFlagRegistryand set'flag'on the registry entry. The theme then appears nowhere until an operator turns it on.Write
public/assets/theme-<name>.css: the variable block first (copy an existing theme's block as the checklist), then the swatch, then scoped rules. Start from the theme closest to the image rather than from scratch, and reuse its file with'stylesheet' => '<owner>'only when the new theme is truly a recolour of it.Graphics are inline SVG data URIs in the CSS. Do not add image files.
Navigation icons follow the existing icon sets; a new theme normally needs no icon changes. If it adds an icon set,
AGENTS.md("Navigation icons") applies.Update the allow-list assertion in
tests/LocalAppSmokeTest.php.
Be bold with appearance and careful with function, as the guide says: every control stays visible and reachable, focus and errors stay distinct, text stays readable, and the page works at about 380px.
3. Don't commit the image
The source image may be someone else's work or show people. Don't add it to the repository and don't put it in the PR unless the person says it is theirs to share. Describe it in the record instead ("a pastel Pinterest moodboard: lilac, cream, sage, rounded cards"). The sampled hex values are enough to review the result.
4. Check it
./v3 test --smoke ThemeRegistryTest ThemeCatalogPageTest PreferencesPageTest FeatureFlagEvaluatorTest LocalAppSmokeTest. Don't run the full suite; say it was not run.python3 tests/theme_contrast_audit.pymust report the new theme OK. If a sampled colour fails contrast, adjust its lightness and note the change.Screenshots with the flag on, at 1280px and 380px: the board, a thread, the theme menu open, and keyboard focus on a link. Seed the theme with
localStorage.setItem('zenmemes-theme', '<name>')in a fresh browser context. Look at them next to the source image and fix what doesn't read as the same picture.With the flag off, the theme must be absent from the menu,
/themesand Preferences.
5. Open the PR
Use the description format in thread to pull request. Include the palette with roles, the screenshots, what you took from the image and what you left out, and how to try it: turn the flag on in Tools -> Feature Flags, then choose the theme. If the request came from a ZenMemes thread, reply there with the PR link and one screenshot.
After merge, deploys need php scripts/build_static_artifacts.php so baked pages know the new theme (the guide explains why).