Ten offline themes for kiwix-serve, the server that serves Wikipedia, Project Gutenberg, iFixit and other ZIM archives on your own network with no internet connection.
Made for home servers, Raspberry Pis and emergency kits: no extra software, no downloads at runtime, no JavaScript framework. Just CSS and one small script that kiwix-serve already knows how to serve.
Unofficial. This is a community project. It is not affiliated with or endorsed by the Kiwix project.
- Ten themes, five light and five dark. Each one restyles the library page and the reader toolbar, and every text colour meets WCAG AA contrast.
- Follows the device. Pick one light and one dark theme; each phone or laptop gets the one that matches its own light or dark setting.
- Theme menu in the browser. Anyone on the network can choose a different theme for their own device. The server setting stays the default.
- Built for blackouts. Works with no internet at all. Red Light is a red-only night mode that keeps your eyes adapted to the dark.
- Small. About 56 KB per pack (14 KB gzipped), system fonts only (the stock Kiwix CSS alone ships 317 KB of web fonts). Fast on a Raspberry Pi and on old phones.
- No patching. No proxy, no fork, no rebuild of Kiwix. One environment variable switches it on, removing it switches it off.
Clone the repository next to your ZIM files:
git clone https://github.com/hildlabs/offline-shelf.gitMount the prebuilt packs and point kiwix-serve at one of them:
services:
kiwix:
image: ghcr.io/kiwix/kiwix-serve:latest
command: "*.zim"
ports:
- "8090:8080"
volumes:
- ./zim:/data:ro
- ./offline-shelf/dist:/themes:ro
environment:
# /themes/<light theme>+<dark theme>/resources.txt
KIWIX_SERVE_CUSTOMIZED_RESOURCES: /themes/paper+lamplight/resources.txtThen docker compose up -d, open http://<server>:8090 and reload once with
Ctrl+F5. A commented copy is in
examples/docker-compose.yml.
All 25 light + dark combinations are prebuilt in dist/. To go back to the stock look, remove the variable and recreate the container.
Without Docker
kiwix-serve reads the same variable on any platform. The paths inside each
resources.txt must exist on your machine, so build the packs for the folder
you serve them from first:
tools/kiwix-theme build-all /srv/offline-shelf/dist
KIWIX_SERVE_CUSTOMIZED_RESOURCES=/srv/offline-shelf/dist/paper+lamplight/resources.txt \
kiwix-serve --port 8090 /srv/zim/*.zim| Theme | Look | |
|---|---|---|
![]() |
Paper | Warm paper, near-black ink, serif titles, a coloured index tab per collection |
![]() |
Atlas | Cool map paper with a faint grid, petrol accent, spaced capitals, monospace details |
![]() |
Newsprint | Black on white, square corners, heavy serif headlines, red accent, greyscale logos |
![]() |
Workshop | Workshop grey, heavy 2 px outlines, blueprint blue, monospace labels |
![]() |
Sage | Sage green, round shapes and logos, rounded type |
| Theme | Look | |
|---|---|---|
![]() |
Lamplight | Warm black, cream text, amber accent, coloured index tabs |
![]() |
Bunker | Phosphor terminal: black and green, monospace everywhere, a blinking cursor |
![]() |
Midnight | Night blue, ivory text, gold accent, italic serif titles |
![]() |
Signal | Charcoal with safety orange, bold capitals, hazard-striped tabs |
![]() |
Red Light | Night vision: black and dim red only, the article is tinted red too |
The reader toolbar follows the theme too: book title, search, random article, back to the library.
Everything works on small screens, with touch-sized buttons and a toolbar that gets out of the way while you read.
About the article itself. The page below the toolbar is the book's own HTML from the ZIM file. It keeps its own styles and, for most Wikimedia books, its own dark mode. Themes leave it alone, with one exception: Red Light tints the whole article red with a CSS filter. Books with a dark mode come out dark red, as above. Books without one come out as a bright red page.
Every pack adds a theme button (the half-filled circle) next to the language button, in the library and in the reader. It opens one short list: Automatic (the server's pack) and the ten themes. The choice is saved in that browser only, so a phone can stay on Red Light while the tablet keeps Paper.
The menu needs no cookie, no account and no extra service. A reload paints the chosen theme from the very first frame.
The pack in KIWIX_SERVE_CUSTOMIZED_RESOURCES is the default for every
device that has not picked a theme. examples/theme.sh
switches it with one command. Copy dist/ to ./themes/offline-shelf/ next to
your compose file, and use these two lines in it:
volumes:
- ./themes/offline-shelf:/themes:ro
environment:
KIWIX_SERVE_CUSTOMIZED_RESOURCES: /themes/${KIWIX_THEME:-paper+lamplight}/resources.txtThen, on the server:
./theme.sh # show the active pack and all themes
./theme.sh newsprint redlight # light theme first, dark theme second
./theme.sh off # stock Kiwix lookThe script writes KIWIX_THEME to .env and recreates the kiwix container,
because kiwix-serve reads the variable only at startup.
kiwix-serve has an undocumented environment variable,
KIWIX_SERVE_CUSTOMIZED_RESOURCES. It points to a text file in which each
line maps a URL to a local file:
/skin/index.css text/css /themes/skin/index.css
kiwix-serve then serves that file instead of its built-in one. A pack replaces:
| URL | Used by | Contents |
|---|---|---|
/skin/kiwix.css |
every page | the light and dark theme tokens, base styles |
/skin/index.css |
library page | layout of the library |
/skin/taskbar.css |
reader | the toolbar above an open book |
/skin/polyfills.js |
library and reader | stock file, unchanged, plus the theme menu |
/skin/os-theme/<name>.css |
theme menu | each theme on its own, loaded only when chosen |
The layout is written once in base/. A theme is a single
themes/<name>/theme.css that only sets colours, fonts and shapes as CSS
custom properties, plus a few extra rules where it needs them. Details,
measurements and limits are in docs/how-it-works.md.
Copy a folder in themes/, change the values in its theme.css, then:
tools/kiwix-theme check # every colour token defined?
tools/kiwix-theme build mytheme lamplight # writes dist/mytheme+lamplight/
tools/kiwix-theme check-server http://localhost:8090 mytheme+lamplightThe first line of theme.css holds the name, the scheme (light or dark)
and a one-line description. Rules after the :root block start with html
and only apply while that theme is active. tools/kiwix-theme is a plain
POSIX shell script; it is only needed to build packs, not to run them.
| kiwix-serve | libkiwix | Status |
|---|---|---|
| 3.8.2 (Docker image) | 14.x | tested: all themes and the menu, in daily use on a Raspberry Pi 4 |
| 3.5.0 | 12.1.1 | the mechanism works; the themes target the 14.x page markup |
| latest | 15.x | not tested yet |
Kiwix may change its page markup or polyfills.js in a later release. If the
menu stops appearing, copy the new stock polyfills.js to
base/upstream/ and rebuild. tools/kiwix-theme check-server
shows which files no longer match.
GPL-3.0-or-later, the same license as Kiwix. The themes are
derived from Kiwix's own CSS and markup, and base/upstream/polyfills.js is
an unchanged copy from libkiwix.













