From 50551114cdc584324abf3cb339494e0143960c72 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Thu, 1 Oct 2026 19:53:06 +0000 Subject: [PATCH] Richer monochrome syntax theme and code-block layout in the standard EPUB Following zenbones and lackluster, the theme keeps what the code names in ink (functions bold, types italic) and moves the language's own syntax to grey (keywords bold grey, literals and punctuation grey). Comments are the lightest. Weight and slant carry the distinctions, so nothing depends on colour. Code blocks stay left-aligned inside a
, which centres for image captions, and have explicit margins. Inline code is display: inline because CREngine readers (KOReader, PocketBook) make it a block. Co-Authored-By: Claude Opus 5.5 --- src/epub/templates/style.css | 48 +++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/src/epub/templates/style.css b/src/epub/templates/style.css index f468341..d78682e 100644 --- a/src/epub/templates/style.css +++ b/src/epub/templates/style.css @@ -221,29 +221,65 @@ hr.rule { font-size: 0.85em; } +/* CREngine readers (KOReader, PocketBook) default `code` to a block. */ +.article-body code { + display: inline; +} + +/* Left even inside a `
`, which centres for image captions. */ .article-body pre { + margin: 0.8em 0; + text-align: left; white-space: pre-wrap; word-wrap: break-word; border-left: 2px solid #cccccc; padding-left: 0.5em; } -/* Syntax tokens (src/highlight.rs), monochrome for e-ink: weight and slant - carry the structure, one grey for comments. Flat selectors on purpose. */ -.hl-keyword, -.hl-tag, +/* Syntax tokens (src/highlight.rs), monochrome for e-ink, after zenbones and + lackluster: what the code names stays in ink (functions bold, types italic), + the language's own furniture steps back to grey (keywords bold grey, + literals and punctuation grey), comments lightest. Flat selectors. */ +.hl-function, +.hl-macro, .hl-title, .hl-strong { font-weight: bold; } -.hl-comment { +.hl-type, +.hl-namespace, +.hl-constructor, +.hl-attribute, +.hl-emphasis { + font-style: italic; +} + +.hl-keyword, +.hl-tag { + font-weight: bold; + color: #555555; +} + +.hl-string { + color: #555555; +} + +.hl-number, +.hl-constant, +.hl-label { font-style: italic; color: #555555; } -.hl-emphasis { +.hl-punctuation, +.hl-operator { + color: #666666; +} + +.hl-comment { font-style: italic; + color: #888888; } .article-body table {