Vanilla Respondage — LimeSurvey theme (version 6/7 compatible), extension of the core Vanilla theme by Respondage. This is a very elaborate starter theme. You can use this as your own or your organisation's theme by adapting the theme settings. You can also make your own variant. See the instructions for this developer's work. Client-specific variants (e.g. `respondage_`) extend this theme via `vanilla_respondage` and contain only a generated `config.xml` plus their own `files/` (logos). LimeSurvey inherits all files (views, css, js, images, options page) from the starter theme, so any change to a file in this theme automatically applies to all variants — no copying of files needed. ## Features - **Neatly formatted options list**: the theme ships its own custom options page (`custom` + `options/options.twig`). All options from `config.xml` are rendered generically, grouped per category in tabs, with consistent Bootstrap form markup, conditional visibility of child options (a field with `parent="..."` is hidden unless the parent is `on`), image previews (lightbox) and image upload — see `options/options.twig` and the sections below. - Header with left / center / right logos in a single top row: the left logo always sticks to the far left, the center logo is always exactly centered (absolutely positioned, independent of the other logos), the right logo always sticks to the far right — so all logos align nicely. The right-side menu texts (language changer, save/clear all, question index) sit on their own row in the header, below the logos, right-aligned. Each logo can be shown/hidden per device (computer / tablet / mobile), and each logo has a top margin option that is the exact distance from the top of the header to the logo (`0` = the logo touches the top of the page). - House-style colors, fonts and logos per client variant, without code duplication (thin variants extending this starter theme). ## Why use this theme Arguments for choosing Respondage Vanilla: - **Local fonts — and you can add your own.** Every selectable font is served from your own LimeSurvey server: the bundled open source fonts in `files/fonts/` (woff2 + `@font-face` in `css/fonts.css`) and the browser/system fonts (the local `font-websafe` package, pure CSS stacks). Adding your own font is documented step by step in `files/fonts/README.md` (license file + font file + `@font-face` + dropdown entry in `config.xml`), and per client variant via `fontOptions` in `variants/.json` + `variants/build.php`. On top of the base (default) font there are per-element font overrides — header, progress bar, question titles, answers/help, group titles/descriptions, buttons — see "Per-element font overrides (fontselect)" below. - **No calls to Google — or any other external host — while surveys are being taken** (privacy by design). Enforced at three levels: (1) all fonts are self-hosted or system fonts, no external `@font-face`/css/js/twig anywhere in the theme; (2) a runtime whitelist in `options/options.js` (`ALLOWED_FONT_PACKAGES = ['websafe']`) that only ever lets the *local* `font-websafe` package into `packages_to_load` — package-based external fonts (e.g. Google-hosted `font-roboto`/`font-noto`) are skipped with a warning, so adding Google Fonts via the theme options is no longer possible; (3) a build-time check in `variants/export_public.sh` that aborts the public release when any text file references an external host. Caveat: if you *deliberately* hardcode an external URL yourself (e.g. a Google Fonts `` in your own css file), no theme can stop a developer from doing that on purpose — but the theme as shipped never does, and such a release would fail the export check. - **Big Tech free, as befits Open Source Software.** The theme is licensed GPL v2 or later (see `LICENSE`), has no proprietary dependencies, no telemetry and no external services: everything a respondent's browser loads during a survey comes from your own server. ## What's in here - `config.xml` — theme manifest incl. all theme options (colors, fonts, font sizes/weights/colors, header logos, ...). - `views/` — twig overrides (header with left/center/right logos and navbar menu color, survey list, question, group description). - `css/*.css` — theme styles (listed in config.xml `` and served as-is by LimeSurvey). The asset manager hashes the file mtime into the published URL, so a changed css is picked up automatically (no cache clear needed). These are BUILD ARTIFACTS: the leading sources are the developer-local `sass/*.sass` files (gitignored) — edit the .sass, compile with `sass --watch sass:css` (or `sass sass/.sass css/.css`), commit the recompiled css. `variants/export_public.sh` aborts the public export if any css/*.css is stale or has no sass source. - `scripts/custom.js` — loaded last, safe for project tweaks. - `options/` — the CUSTOM options page: config.xml sets `custom`, so LimeSurvey renders `options/options.twig` (and auto-registers `options/options.js`) instead of the core `options_core.php`. The twig renders all options generically from the `` in config.xml (via `aOptionAttributes`), grouped by category, so adding an option to config.xml is enough — it appears in the UI automatically. `options/options.js` is a copy of the core package `assets/packages/themeoptions-core/themeoptions-core.js` (patched to also hide `.action_hide_on_inherit` rows on "Inherit everything"; re-apply that patch when updating the copy). - `variants/` — the GENERIC tooling is tracked and public: `build.php`, `build_all.sh`, `export_public.sh` and `example/` (the public example output of a variant build). Only the confidential parts are gitignored (see `.gitignore`): `variants/*.json` (client definitions with house-style values), `variants/leak-patterns.txt` and `variants/tests/` — those live in the private variants repo, not here. - `translations/` — the translation spreadsheet workflow: `labels.csv` (all theme labels, one row per source string, one column per language) plus `sync_labels.php` (re-extracts labels from `config.xml`, keeps existing translations) and `csv_to_sql.php` (CSV → SQL for the `lime_source_message`/ `lime_message` tables). See "Multiple languages in the theme options (i18n)". ## Multiple languages in the theme options (i18n) All labels on the custom options page (`options/options.twig`) go through `gT()`: option `title`s, category names, `optionlabels`, the Yes/No/Inherit buttons, and the dropdown labels (via `TemplateManifest::translateDropdownOptions()`; in our twig via `gT()` on the options). The options page therefore automatically shows the logged-in admin's UI language — for every string that exists in the translation catalog. LimeSurvey merges two translation sources (`LSMessageSource::loadMessages()`): 1. the gettext catalogs `locale//.mo` — these contain all core strings in ~60 languages (Yes, No, Inherit, ...); 2. the database tables `lime_source_message` + `lime_message` (`source_message(id, category, message)`, `message(id, language, translation)`; merged at DBVersion >= 480). **Translating your own theme strings** is done per installation via the message tables (pure data in your own DB, no core change). The source string must exactly match the `title=` in config.xml (English is the source language): ```sql INSERT INTO lime_source_message (category, message) VALUES ('', 'Display logo on the left of the header'); INSERT INTO lime_message (id, language, translation) VALUES (LAST_INSERT_ID(), 'nl', 'Toon logo links in de header'); ``` Repeat per language/label. The admin sees the translation as soon as their UI language matches. Note: the sandboxed twig has no accessor for the current language code, so an in-theme translation dictionary cannot reliably pick the language — the message tables are the right mechanism for that (a feature request to expose the current language to twig has been prepared for the LimeSurvey developers). **Translating via a spreadsheet (recommended workflow).** All theme labels live in `translations/labels.csv` — one row per source string (`context,key,source,`, by default one `nl` column), ready to open in Excel/LibreOffice. Keep it up to date during development with: php translations/sync_labels.php # re-extract labels from config.xml: # new strings are appended with empty # translation cells, existing translations # are preserved, removed strings are dropped php translations/sync_labels.php --check # exit 1 when labels.csv is stale # (run this after changing config.xml) After editing translations in the spreadsheet, generate the SQL for the message tables and run it in the installation's database: php translations/csv_to_sql.php translations/labels.csv nl > nl.sql mysql -h localhost -u -p < nl.sql (`csv_to_sql.php` emits idempotent INSERTs — safe to re-run after each edit. Add a language by adding a column to the CSV header, e.g. `de`.) To ship translations with the theme itself, commit the filled-in `labels.csv` — **still to be done:** no translations are filled in yet; the theme ships only the English source strings. Contributions of translations to this repository are welcome. ## Header logos (left / center / right) Three independent logo file options in the Header category: `brandlogofile` (left), `centerlogofile` (center), `rightlogofile` (right) — each is an `imagefile` option where `off` means "no logo". All three logos share one top-aligned row (`.survey-nav-logo-row` in `nav_bar.twig`); the center logo is absolutely positioned at `left: 50%` of that row (see `css/plain.css`), so it sits in the true center of the header no matter how wide the left or right logo is. Logo files are looked up in the theme's own `files/` folder first, then in the starter theme's `files/` folder (and validated by core: only `gif,ico,jpg,jpeg,png` — SVG is rejected). Per logo there are also three visibility checkboxes — `brandshowoncomputer`, `brandshowontablet`, `brandshowonmobile` (and the `center…`/`right…` equivalents), Header category, default computer/tablet on, mobile off — mapped to Bootstrap display classes in `nav_bar.twig` (`logoVisibilityClasses()`). All logo options appear automatically in the custom options page (see `options/options.twig`). ## Menu item color in the top bar Option `navbarfontcolor` (Header category) is a color-chooser dropdown (`default | defaultbackgroundcolor | color1 | color2 | color3 | other`, plus the `navbarfontcolorcustom` picker for "Other ..."): `default` = the default font color, `color1/2/3` = primary/secondary/tertiary color, a legacy stored hex passes through directly. It is resolved and applied in `views/subviews/header/custom_header.twig` and should contrast with `headerbackgroundcolor` (same chooser scheme). ## Distance from the logo to the top of the screen Per logo, options `brandlogotopmargin` / `centerlogotopmargin` / `rightlogotopmargin` (Header category, plain px number 0-100, e.g. `30` or `0`) set the distance from the top of the header to the top of that logo, applied as `margin-top` on the logo container in `custom_header.twig`. The header content is top-aligned and the logo containers/images have no top padding (see `css/plain.css`), so the value is the EXACT distance: use `0` to make a logo touch the top of the page. ## Sticky header per screen size (computer / tablet / mobile) In the **Header** tab: `headerstickycomputer` ("Computer screen"), `headerstickytablet` ("Tablet"), `headerstickymobile` ("Mobile phone") checkboxes, independent of each other (the legacy `headersticky` Yes/No master switch still exists but no longer gates them). Defaults: sticky on computer and tablet, **not** on mobile. The breakpoints are Bootstrap's default ones: phone < `md` (768px), tablet `md`–`lg` (768–991px), computer ≥ `lg` (992px). `custom_header.twig` emits the `.fixed-top` rules inside the selected range(s) as media queries on `#survey-nav`; `nav_bar.twig` does not hardcode `fixed-top`. `scripts/custom.js` corrects the body `padding-top` per viewport: when the header is not fixed at the current width, the extra padding is removed. ## Bundled open source fonts (self-hosted custom fonts) To show that self-hosted fonts work just as well as browser fonts, the starter theme bundles four OFL-licensed fonts (woff2) in `files/fonts/`: - **Inter** (sans-serif, variable 100–900) — **the default of the `font` option**, see "Default font" below - **Noto Sans** (sans-serif, variable 100–900) — multilingual fallback, stacked directly behind Inter in the `.font-inter` rule - **Noto Serif** (serif, variable 100–900) — the one bundled serif; also covers non-Latin scripts - **Atkinson Hyperlegible** (sans-serif, static 400 + 700) — https://github.com/googlefonts/atkinson-hyperlegible — the accessibility variant, see below They are wired up like any custom font: `@font-face` + generic `.font-` rules in `css/fonts.css` (compiled from `sass/fonts.sass`; registered in `config.xml` ``), and dropdown entries in the optgroup **"Bundled open source fonts"** of the `font` option (`data-font-package` stays `websafe`; the real font is loaded by the theme's own css, not by a core package). The selected base font is applied as class `font-` on ``. ### Default font: why Inter The default of the `font` option in this mother theme is **Inter**. At survey sizes (14–20 px body text) Inter has the best screen readability of the bundled set: a tall x-height, open apertures and generous letterspacing survive low-resolution screens and projectors, where print-first serifs (thin hairlines, small x-height) degrade badly. **Noto Sans** is stacked directly behind Inter in the `.font-inter` font stack, so the huge script coverage of Noto (non-Latin scripts in multilingual surveys) is still served from the same self-hosted file — no extra download, no external request. **Noto Serif** is kept as the single bundled serif for the same reason (non-Latin support), and for users who genuinely want a serif for body text. **Accessibility alternative: Atkinson Hyperlegible.** If the target population has reading impairments (lower vision, dyslexia, older respondent panels), pick **Atkinson Hyperlegible** as the base font instead: it was designed by the Braille Institute with evidence-based, highly distinct letterforms (e.g. an unambiguous "l/1/I") that measurably improve reading without looking "special". It is bundled and selectable like any other font; it is *not* the default because Inter reads slightly better for the general population at small sizes. ### Font variants (weights and styles) — what is real and what is synthesized The per-element font options offer `normal | bold | italic | bolditalic`. What you actually get depends on the faces the font ships: - **Inter, Noto Sans, Noto Serif** (variable fonts): every `font-weight` in the declared range (100–900) is a **real** weight from the variable axis. Only `font-style: normal` faces are declared, so **italic and bold-italic are synthesized by the browser** (faux italic / faux bold on top of the real weight) — there are no true italic faces in the bundle. - **Atkinson Hyperlegible** (static): only the **400 and 700** faces are shipped. Weights 400/700 are real; any other weight is synthesized by the browser. Like the variable fonts, no italic faces: italic/bold-italic are faux. - **Browser fonts (websafe) and core server packages**: variants depend on what the respondent's OS / the LimeSurvey server actually has installed (e.g. Arial has real bold/italic on most systems); the theme cannot control that. Rule of thumb for template choices: use `bold` freely (real or safely synthesized everywhere), and treat `italic` on the bundled fonts as a synthesized slant — fine for emphasis, not a true italic design. ### Font dropdown order and defaults The optgroups of every font dropdown (base `font` + all per-element `fontselect` overrides) are ordered as: 1. **Custom (this theme)** — only shown when the theme/variant ships its own font(s); an empty category is removed from the dropdown 2. **Bundled open source fonts** — the self-hosted fonts above 3. **User browser** — websafe system fonts 4. **Local server - Core / User** — the font packages installed on the LimeSurvey server itself, always last because they differ per installation Core prepends the "Local server" groups **server-side** (`TemplateManifest:: getOptionAttributes()` inserts them before the config.xml optgroups), so this order can only be applied client-side. It is done by an **inline script in `options/options.twig`** (`registerScript(..., 'POS_END')` — an explicit position is required, the default resolves to a position Yii never renders), rendered into the page HTML itself so it always runs on a fresh page load. The same logic is in `options/options.js` (`reorderFontDropdowns()`) as a fallback; running twice is idempotent. Server packages are detected structurally: their first option has `data-font-package === value`. The inline script also removes **empty optgroups** and sets the base font select's value from the stored options (and patches it into the serialized JSON on submit), so the default font displays and saves correctly even if `options/options.js` itself was served stale from the browser cache. Because core registers `options/options.js` **without a cache-busting hash** (`LSETwigViewRenderer::renderOptionPage()`), browsers may heuristically cache it (the file is served with only `Last-Modified`/`ETag`). `options/options.twig` therefore re-registers it as `options.js?v=` — **bump `OPTIONS_JS_TOKEN` in `options/options.twig` whenever `options/options.js` changes**, so every browser fetches the new file once. Default of the `font` option in this mother theme is **Inter** (a bundled font, so the showcase looks identical on every installation — never a core package font, which varies per server; see "Default font: why Inter" above). `variants/build.php` automatically sets the default of a variant to its first `fontOptions` entry (the client's own font) when the variant json does not set `options.font` explicitly. ## Per-element font overrides (fontselect) Next to the base `font` (the default, used everywhere), the **Fonts** tab offers one dropdown per page element: header/top menu (`headerfont`), progress bar (`progressbarfont`), question titles (`questiontitlefont`), answers + help texts (`answersfont`), group titles (`grouptitlefont`), group descriptions (`groupdescriptionfont`) and the navigator buttons (`buttonsfont`). Each dropdown offers the same choices as the base font dropdown (bundled + variant-custom + browser fonts) plus **"Same as base font"** (value `base`, the default: no extra class is emitted, the element inherits the body font). A chosen value is applied as class `font-` on that element in the views — which is why the class rules in `css/fonts.css` (and in a variant's own css) must be generic (`.font-x`, not `body.font-x`). `options/options.js` makes sure the packages of all selected fonts are loaded (`packages_to_load`). **Adding your own font?** See `files/fonts/README.md` (English walkthrough: license file + font file in `files/fonts/`, `@font-face` rule in `css/fonts.css`, `