feat: export themes preset bundles for coherent visual styles#70
feat: export themes preset bundles for coherent visual styles#70smur89 wants to merge 2 commits into
Conversation
b71dad0 to
dc67958
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds a ChangesTheme presets bundle
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
dc67958 to
4e70e92
Compare
`themes` is a dict of vetted preference bundles — `classic`, `modern`,
`minimal` — each setting the four knobs that interact visually
(`accent`, `font`, `columnRatio`, `headerTextAlign`). Callers spread a
theme over their own overrides:
#alta(cv, preferences: themes.modern + (imageSize: 7em))
Themes are partial preferences dicts; any key they don't set falls back
to `_default_preferences`, so per-document tweaks (paper, image sizing,
section order) stay one-line edits. The dict is module-scope and
exported alongside `maps-providers`, matching the precedent for exposed
preset lookups.
A `tests/themes.typ` fixture exercises each built-in theme plus the
spread-and-override pattern. Non-classic themes override `font` back to
`Lato` in the fixture so the CI host (which doesn't ship Inter or
Source Sans 3) compiles without font-fallback warnings.
Closes #58
78cdb0f to
81671c4
Compare
|
Superseded by #125 — rebuilt against the post-refactor module layout ( |
Summary
Adds a module-scope
themesdict —classic,modern,minimal— exporting vetted preset bundles of preferences that hang together visually (accent,font,columnRatio,headerTextAlign). Callers spread a theme over their own overrides:Closes #58.
Design notes for the reviewer
accent,font,columnRatio,imagePosition,headerTextAlign). I shipped four — leftimagePositionout because it's only meaningful whenbasics.imageis set, and baking it into every theme would either force image-only assumptions or no-op for image-less CVs. Users addimagePositionthemselves via the spread-and-override pattern.rgb(...)accents directly — they're self-contained today. When palettes land, themes can refactor internally to reference them without changing their public API.classicre-declares current defaults. Deliberate, not a redirect — themes are bundles by name, not pointers to "whatever the default is right now". Meansclassicwill drift if defaults change; that's the cost of having a stable named bundle and I think it's worth it.maps-providers. Same precedent: an exported dict of named presets the user spreads intopreferences. No new merge / validation logic —_strict_mergeinalta()already validates the spread result against_default_preferences.InterandSource Sans 3aren't installed on the CI host (onlyLatois). The fixture overridesfont: "Lato"after each non-classic theme spread so CI compiles silently. Users on local machines with the right fonts installed will get the intended typography; users without will get Typst's font-fallback warning (the existing behaviour for any unknownfontvalue), which the README now flags.Happy to push back on any of these — particularly the theme-vs-palette decoupling and the exact bundle contents.
Rendered output
examples/tests/themes.pdfis committed; the four pages showclassic,modern(withLatofont override for CI),minimal(likewise), and the spread-and-override pattern.Test plan
typst compile --root . examples/example.typ examples/example.pdfsucceedstests/*.typfixture compiles (make testclean — no warnings)tests/themes.typfixture exercising every built-in theme + the spread-override patternNotes for the reviewer
fontvalue formodern(Inter) andminimal(Source Sans 3) is aspirational — neither is on CI. Acceptable because Typst falls back rather than panicking, and users who install the named font get the intended look. If you'd prefer the defaults all resolve to a CI-installed font, swapmodern/minimaltoLatoand rely on accent + layout to differentiate them.imagePositionand thepalettesdependency are both pre-existing tracked work.JSON Resume alignment
Not applicable — theme presets bundle template-side preferences (
accent,font,columnRatio,headerTextAlign), which sit entirely outside the JSON Resume data schema (https://jsonresume.org/schema/). Thethemesdict is a sibling ofmaps-providers, not acv.*field.Summary by CodeRabbit
New Features
Documentation
Tests