Documentation
¶
Overview ¶
Package theme carries the default Hugo theme, embedded in the binary so a user only writes Markdown — they never have to fetch or wire up a theme. The embedded copy is the single source of truth: build materializes it fresh each run. A user's own project-level layouts/ still override it (Hugo's normal layering), which is the theme's intended override layer.
Index ¶
Constants ¶
const CustomCSS = `/* Your theme's editable surface.
These variables ARE the official way to restyle a crofty site. Edit freely —
this file loads after the bundled theme, so whatever you set here wins. No
matter how you change it, ` + "`crofty doctor`" + ` confirms your site still owns
its content: a canonical link, a feed, and no third-party tracking.
Want to change more than colour and type? ` + "`crofty theme eject --full`" + `
writes the whole theme (layouts + CSS) into your project to edit directly. */
:root {
--bg: #fcfbf7; /* page background */
--ink: #211e1a; /* body text and headings */
--muted: #6f6a61; /* dates, captions, secondary text */
--line: #e4e0d8; /* rules, borders, link underlines */
--accent: #5c4b37; /* links on hover, active marks */
--code-bg: #f2efe7; /* inline code and code blocks */
--measure: 34rem; /* reading-column width */
/* Point --font-body at var(--font-mono) for a terminal feel, or drop in any
family. --font-chrome is the header/footer/meta face. */
--font-body: Charter, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
--font-chrome: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
--font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
/* Dark mode follows the reader's system setting. Delete this block to opt out,
or set your own dark palette here. */
@media (prefers-color-scheme: dark) {
:root {
--bg: #17150f;
--ink: #e9e5dc;
--muted: #9a9488;
--line: #322e27;
--accent: #c9b79a;
--code-bg: #221f18;
}
}
`
CustomCSS is the starter override `crofty theme eject` writes. It mirrors the :root tokens in the bundled crofty.css with their default values, so editing it is the safe, documented way to restyle: it loads after crofty.css (see baseof.html), so whatever is set here wins, and it can only touch design — `crofty doctor` still guarantees the site owns its content. The token NAMES here must stay in sync with crofty.css; eject_test.go guards against drift.
const CustomCSSPath = "assets/css/custom.css"
CustomCSSPath is where `crofty theme eject` writes the starter token override, relative to the project root. It lives under assets/ so Hugo's resources.Get picks it up (baseof links it only when present) and so it sits on the documented customization seam (assets/, layouts/).
Variables ¶
This section is empty.
Functions ¶
func EjectFull ¶
EjectFull writes the whole bundled theme into dst (a project root) as the override layer: layouts/, static/, i18n/ land at the same paths Hugo overrides from, so they take effect immediately while the project stays a crofty project. theme.toml is skipped — it is theme metadata, unused at the project root. Existing files are left untouched unless force is set, so re-running never clobbers edits. Returns the relative paths written and skipped.
func IsShippedCSS ¶
IsShippedCSS reports whether content is exactly one of the token files crofty itself writes — the eject default or a preset — i.e. not hand-edited. `theme set` uses it to know it can swap presets freely without clobbering real work.
func Materialize ¶
Materialize writes the embedded theme into dst, replacing any existing tree.
Types ¶
type Preset ¶
A Preset is a named look `crofty theme set` writes to assets/css/custom.css. Each is just a different set of values for the same tokens the default theme declares (presets.go and crofty.css share a token set; eject_test.go guards it), so switching a preset can only change the look — never the output contract. Presets are the cheap proof that a crofty site is yours to reshape.
func PresetByName ¶
PresetByName returns the named preset, or ok=false if there is no such preset.