5.4.4
Looks
Pick Lodestar's type, accent color, home page hero and details, set the dark mode switch, or make your own accent.
You pick the look in one file, src/theme.look.ts. It applies to both content sources. It has five settings:
pairing: the type."hearth"(Fraunces over Hanken Grotesk, the default),"chambers"(Lodestar Serif over Libre Franklin) or"studio"(Bricolage Grotesque over Figtree, with emphasis by weight and no italic). Only the chosen pairing’s fonts load.accent: the color of the buttons, the star marks, small accent text, the focus ring and the text selection."ember"(marigold, the default),"fir"(deep green),"harbor"(navy) or"claret"(wine).hero: the top of the home page."photo"(the text over a full-width photo, the default),"split"(the headline beside a tall photo) or"stack"(Headline first: the headline, centered, above a wide photo).details: four switches, each on by default. See below.modeSwitch: the light and dark switch in the nav.true(the default) orfalse. See “Light and dark mode.”
For example:
export const pairing: Pairing = "chambers";
export const accent: Accent = "harbor";
export const hero: Hero = "split";
pnpm check, pnpm dev and the build stop on an unknown value. A production server never fails on one. It uses the default instead and logs the bad value.
With the Headline first hero ("stack"), the photo keeps its top edge, so any crop comes off the bottom. On phones, the text sits on the left.
The details
details has four switches:
star: a four-point star on eyebrows, bullets, the industry list and the wordmark. Off: small dots.arch: an arched top on the Split and Headline first hero photos, the home page’s “Why us” photo and the team portraits. Off: rounded corners.guide: thin lines after eyebrows, between the stats and above the footer’s last row. Off: no lines.italic: the one phrase you mark in a heading with asterisks, such asBuilt for *the long run*, in italic. Off: the same face, upright.
export const details: Details = { star: true, arch: false, guide: true, italic: true };
Under reduced motion, nothing fades or moves.
Light and dark mode
Light and dark mode follow the visitor’s system setting. The moon button in the nav lets them pick. One press shows the other mode. A press back to the mode their system shows lets the site follow the system again. On a phone, the button sits beside the menu button.
The choice is saved in the visitor’s browser and applies on every page. A small script at the top of the page applies it before the page paints, so a visitor who chose dark never sees a light page first. Without JavaScript, the button is hidden and the site follows the system setting.
- Turn the button off: set
modeSwitchtofalse. The button and its script are gone, and the site follows each visitor’s system setting. A choice a visitor saved before is no longer read. - Force one mode: turn the button off, then set
data-theme="light"ordata-theme="dark"on<html>insrc/layouts/Base.astro.
Make your own accent
An accent has six values: the button and its text on a light ground, small accent text on a light ground, accent text on a dark ground, and the button and its text on a dark ground. src/styles/accents/ember.css describes each one.
- Copy a file in
src/styles/accents/, for examplefir.csstoslate.css. - In the new file, change the id in the selector (
data-accent="slate") and change the six colors. - Add the accent to
src/styles/accents/accents.json: itsid, alabeland the same six values. - Add the id to
ACCENTSinsrc/utils/look.ts, and import the file insrc/styles/global.css, after the other accents. - Run
pnpm test:skins. It checks that each accent inaccents.jsonhas a file and an import, that the values match, and that the colors have enough contrast (WCAG AA) on every ground, in light and dark mode, and over photos.
Favicon and share images
public/favicon.svg is the star mark in Ember’s marigold (#ffa911) on a dark ground (#1f1915). It does not change with the accent. If you use another accent, change these colors yourself.
Every public page gets a share image. Its accent follows your look.