Notes · CSS · Architecture · TypeScript

Six characters, one template: themes as data

How I turned my original characters’ pages into a single template where each character only brings its content, its palette and a few variants.

Published: · 4 min read · REPO

I started with two character pages, each with its own CSS. Moving to six, copying and adapting was no longer an option: every improvement had to be repeated in all of them.

The palette lives in the data

Each profile has a look object with its palette. The page turns it into inline CSS variables, and the template only uses variables. A new character does not need a single line of CSS to get its colours.

look: {
  palette: { ground: '#0b0a09', accent: '#d9a75a', paper: '#ebe1cb', /* … */ },
  atmosphere: { src: '/archive/marlowe/stock/marlowe-city-rain.webp', style: 'photo' },
  foreground: { style: 'blinds' },
  halo: 'lamp',
  card: 'dossier',
}

Variants instead of exceptions

What is not colour (the halo behind the character, the kind of file card, the foreground layer) is a named variant: gauge, moon, sigil, lamp or aureole for the halo; notebook, herbarium, dossier, pact or illuminated for the card. Each variant is a class. A character picks; it does not rewrite.

Routes, shelf and SEO come for free

  • The #oc-<id> route looks the profile up by id; if it does not exist, it goes back to the shelf.
  • The shelf and the “next volume” link walk the list in order.
  • A script generates a static page per character, in Spanish and English, for search engines.

Adding a character is now writing its data file and running one command.

Could something like this help your project? I work as a freelance web developer. Write to me