BearletterDocsllms.txtbearletter.comDashboard

Blog format

Themes

How styles.css is laid out, the variables themes share, light and dark modes, and the page's class names.

The whole look of a blog is styles.css. Choosing a theme in the dashboard replaces this file with the theme's stylesheet; after that it is yours. Editing it needs Pro.

Variables#

Every built-in theme starts with one :root block of variables. The dashboard's Appearance controls change --accent, --width, --font-body and --font-size there and leave the rest alone, so keep that block first.

:root {
  --width: 760px;
  --font-body: Georgia, "Songti SC", serif;
  --font-heading: var(--font-body);
  --font-size: 18px;
  --bg: #fffdf8;
  --text: #2e2b3a;
  --heading: #1d1b26;
  --link: #1d1b26;
  --muted: #4a4658;
  --rule: #e2ddcf;
  --code-bg: #f3efe3;
  --accent: #4b3fd1;
}

Themes may add their own variables (Bold has --band and --marker; Poster has --panel and --accent-text).

Light and dark#

A theme follows the reader's system. Put the dark values in a media query after the first block:

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17151f;
    --text: #e4e0d6;
    --heading: #fffdf8;
    --link: #fffdf8;
  }
}

A color used for text on a fill (such as dark ink on a yellow button) can stay the same in both modes.

Page structure#

Every page has the same frame:

<body class="post">
  <header class="site-header">
    <a class="title" href="/">Blog name</a>
    <nav class="site-nav">…</nav>
  </header>
  <main>…</main>
  <footer class="site-footer">…</footer>
  <p class="powered-by">…</p>
</body>

The body's class says what the page is: home, post, page, archive, directory, not-found, podcast-show, plus an article's own class_name.

Class names worth styling:

Elements inside articles are plain HTML (h1–h4, p, blockquote, pre, code, table, img, hr), so style them by tag.

Checking a change#

Try a stylesheet before saving it: the dashboard's theme cards open a preview of your own blog with that theme, and nothing changes until you choose it.

Bearletter · bearletter.com · Every page is also Markdown: llms.txt