Illuminated Print — Implementation Plan
Date: 2026-02-15
Status: Ready for execution
Design: doc/process/plans/2026-02-15-illuminated-print-design.md
Branch: feature/illuminated-print
Approach: Test-driven development — write failing test, implement, verify
Test Infrastructure
Tests use Playwright (Python) with the dev server. Each step adds tests to
src/tests/test_illuminated_print.py. Tests verify CSS computed values
and visual structure, not pixel screenshots.
Test Helpers
def get_css(page, selector, prop):
"""Return computed CSS property value for selector."""
return page.evaluate(f"""
getComputedStyle(document.querySelector('{selector}')).{prop}
""")
def get_css_var(page, prop):
"""Return CSS custom property value from :root."""
return page.evaluate(f"""
getComputedStyle(document.documentElement).getPropertyValue('{prop}').trim()
""")
Implementation Steps
Step 1: Colour Tokens
Test: Verify all CSS custom properties are defined on :root.
class TestColourTokens:
def test_pigment_tokens_defined(self, page):
"""All four pigment solids exist as CSS custom properties."""
for token in ['--illum-ultramarine', '--illum-vermilion',
'--illum-verdigris', '--illum-saffron']:
val = get_css_var(page, token)
assert val, f"Missing token: {token}"
def test_wash_tokens_defined(self, page):
"""Category wash tokens exist."""
for token in ['--wash-ultramarine', '--wash-vermilion',
'--wash-verdigris', '--wash-saffron',
'--wash-parchment']:
val = get_css_var(page, token)
assert val, f"Missing wash token: {token}"
Implement: Add :root block with all colour tokens to almanack.css.
Commit: “Add illuminated print colour tokens”
Step 2: Background
Test: Verify html background is flat near-white (no SVG noise image).
def test_background_is_flat(self, page):
"""Background should be flat #fcfcfa, no SVG noise."""
bg_image = get_css(page, 'html', 'backgroundImage')
assert bg_image == 'none' or 'svg' not in bg_image.lower()
Implement: Override html background to flat --color-bg: #fcfcfa.
Remove SVG fractal noise + radial vignette.
Commit: “Replace paper texture with flat near-white background”
Step 3: Masthead Illuminated Rule
Test: Verify masthead ::after exists with correct height, and masthead
no longer has border-bottom: 3px double.
def test_masthead_rule_is_illuminated(self, page):
"""Masthead uses ::after illuminated rule, not double border."""
border = get_css(page, '.masthead', 'borderBottom')
assert 'double' not in border
# ::after has multi-background rule
height = page.evaluate("""
getComputedStyle(document.querySelector('.masthead'), '::after').height
""")
assert height == '5px'
Implement: Replace border-bottom: 3px double with ::after multi-
background (saffron top, vermilion dots at 8em, ultramarine bottom). Add
saffron sunburst radial-gradient on .masthead. Colour meta text saffron.
Commit: “Add illuminated masthead rule with periodic dots”
Step 4: Article Header (Rubrication + Aureole)
Test: Verify .rubricate elements are vermilion, headline has ::before
and ::after pseudo-elements (ornament endcaps), header has aureole
::before.
def test_rubricate_is_vermilion(self, page):
"""Elements with .rubricate class are vermilion."""
color = get_css(page, '.rubricate', 'color')
assert 'rgb(163, 58, 43)' in color
def test_headline_has_ornament_endcaps(self, page):
"""Title has ::before and ::after containing ✦."""
before = page.evaluate("""
getComputedStyle(document.querySelector('header .title'), '::before').content
""")
assert '✦' in before or '10022' in before or '2726' in before
Implement: Add .rubricate class style. Add ::before/::after on
header .title for ✦ endcaps. Add aureole ::before on header. Add
dinky-bar element.
Template change: Modify partials/header.html to wrap connectives in
<span class="rubricate"> and add dinky-bar <div>.
Commit: “Add rubricated headline with ornament endcaps and aureole”
Step 5: Illuminated Initial
Test: Verify .illuminated-initial container exists wrapping .initial,
with saffron outer border and proper sizing.
def test_illuminated_initial_container(self, page):
"""Initial image wrapped in illuminated frame."""
container = page.query_selector('.illuminated-initial')
assert container is not None
img = container.query_selector('.initial')
assert img is not None
def test_initial_frame_has_saffron_border(self, page):
"""Illuminated initial has saffron outer border."""
border_color = get_css(page, '.illuminated-initial', 'borderColor')
# Saffron #B8892E = rgb(184, 137, 46)
assert 'rgb(184, 137, 46)' in border_color
def test_initial_maintains_four_line_height(self, page):
"""Container height preserves 4-line alignment with box-sizing: border-box."""
box_sizing = get_css(page, '.illuminated-initial', 'boxSizing')
assert box_sizing == 'border-box'
Implement: Add .illuminated-initial styles: float, border-box sizing
at calc(9rem + 0.2em), saffron border, corner dots, halo.
Template change: Wrap <img class="initial"> in
<span class="illuminated-initial"> in article.html.
Commit: “Add illuminated initial frame with corner rosettes”
Step 6: Links and Footnotes
Test: Verify link underline colour is ultramarine, footnote superscripts are ultramarine.
def test_link_underline_ultramarine(self, page):
"""Body link underlines are ultramarine wash."""
color = get_css(page, '.body-text a', 'textDecorationColor')
# Should contain blue channel
assert 'rgba(47, 74, 122' in color
def test_footnote_sup_ultramarine(self, page):
"""Footnote superscripts are ultramarine."""
color = get_css(page, '.footnote-ref', 'color')
assert 'rgb' in color # Not default black
Implement: Add link underline and footnote colour rules to almanack.css.
Commit: “Colour links and footnotes with ultramarine”
Step 7: Horizontal Rules
Test: Verify HR uses saffron gradient, not black.
def test_hr_is_saffron(self, page):
"""Standard HR uses saffron gradient."""
bg = get_css(page, 'hr', 'backgroundImage')
assert 'gradient' in bg or bg != 'none'
# Black bar should be gone
bg_color = get_css(page, 'hr', 'backgroundColor')
assert bg_color != 'rgb(26, 26, 26)' # Not --color-text
Implement: Replace hr { background-color: var(--color-text) } with
saffron gradient. Add ornamental HR variant.
Commit: “Replace black rules with saffron illuminated rules”
Step 8: SVG Grain Filter
Test: Verify the SVG filter element exists in the DOM.
def test_svg_grain_filter_in_dom(self, page):
"""SVG grain filter is present in base template."""
filter_el = page.query_selector('#wc-grain')
assert filter_el is not None
turbulence = page.query_selector('#wc-grain feTurbulence')
assert turbulence is not None
Implement: Add inline SVG <defs> to base.html, before the closing
</body> tag.
Commit: “Add SVG grain filter definition to base template”
Step 9: Margin Box Wash CSS
Test: Verify wash classes set --wc-wash custom property, and that
::before/::after pseudo-elements exist on washed boxes.
def test_wash_class_sets_variable(self, page):
"""Wash class sets --wc-wash custom property."""
# Need a margin box with the class to test against
page.evaluate("""
const box = document.querySelector('.margin-box');
if (box) box.classList.add('wc-mb-ultramarine');
""")
val = page.evaluate("""
const box = document.querySelector('.wc-mb-ultramarine');
if (!box) return '';
return getComputedStyle(box).getPropertyValue('--wc-wash').trim();
""")
assert val != ''
def test_wash_box_has_grain_layer(self, page):
"""Washed margin box has ::after grain layer with SVG filter."""
page.evaluate("""
const box = document.querySelector('.margin-box');
if (box) box.classList.add('wc-mb-ultramarine');
""")
filter_val = page.evaluate("""
const box = document.querySelector('.wc-mb-ultramarine');
if (!box) return '';
return getComputedStyle(box, '::after').filter;
""")
assert 'wc-grain' in filter_val
Implement: Add wash classes, border classes, two-layer pseudo-element
system, and isolation: isolate to almanack.css.
Commit: “Add margin box wash classes with grain texture”
Step 10: Wash Assignment in sidenotes.js
Test: Verify that after sidenotes.js runs, margin boxes have wash classes assigned.
def test_margin_boxes_get_wash_classes(self, page):
"""After JS, margin boxes have wc-mb-* wash classes."""
page.wait_for_selector('.sidenotes-ready')
boxes = page.query_selector_all('.margin-box.margin-left, .margin-box.margin-right')
washed = [b for b in boxes if any(
'wc-mb-' in c for c in b.evaluate('el => [...el.classList]')
)]
# Not all boxes need washes (sidenotes don't), but typed boxes should
assert len(washed) > 0
def test_sidenotes_have_no_wash(self, page):
"""Sidenotes (manicule elements) should not have wash classes."""
page.wait_for_selector('.sidenotes-ready')
sidenotes = page.query_selector_all('.sidenote')
for sn in sidenotes:
classes = sn.evaluate('el => [...el.classList]')
assert not any('wc-mb-' in c for c in classes)
def test_convention_map_applies(self, page):
"""Quote-type margin boxes get vermilion wash by convention."""
page.wait_for_selector('.sidenotes-ready')
quote_boxes = page.query_selector_all('.margin-box[data-type="quote"]')
for box in quote_boxes:
classes = box.evaluate('el => [...el.classList]')
has_wash = any('wc-mb-' in c for c in classes)
if has_wash:
assert 'wc-mb-vermilion' in classes
Implement: Add to sidenotes.js:
- Convention map:
{ quote: 'vermilion', ad: 'saffron', aphorism: 'saffron', poem: 'verdigris', annotation: 'ultramarine' } - In
positionMarginBoxes(), after placement, iterate boxes: - If
data-washattr → use that - Else if
data-typein convention map → use that - Else → assign from remaining pigments for column balance
- Apply class:
box.classList.add('wc-mb-' + washColour)
Commit: “Add wash assignment logic to sidenotes.js”
Step 11: Manicule Colours
Test: Verify manicules are ultramarine.
def test_manicules_are_ultramarine(self, page):
"""Manicule characters (☞/☜) are ultramarine."""
page.wait_for_selector('.sidenotes-ready')
color = page.evaluate("""
const num = document.querySelector('.sidenote-number');
return num ? getComputedStyle(num).color : '';
""")
# Should be ultramarine: rgb(47, 74, 122)
assert 'rgb(47, 74, 122)' in color
Implement: Add .sidenote-number colour rule to almanack.css.
Commit: “Colour manicules ultramarine”
Step 12: Mobile Verification
Test: Verify washes render in mobile swipe mode, headline stays in centre column.
@pytest.mark.mobile
class TestIlluminatedMobile:
def test_washes_visible_in_swipe_mode(self, mobile_page):
"""Margin box washes render in mobile swipe layout."""
mobile_page.wait_for_selector('.swipe-margins-enabled')
# Swipe to margin
# ... (swipe gesture)
# Verify a washed box has background
has_wash = mobile_page.evaluate("""
const box = document.querySelector('.margin-box[class*="wc-mb-"]');
if (!box) return false;
const bg = getComputedStyle(box, '::before').backgroundColor;
return bg !== 'rgba(0, 0, 0, 0)';
""")
assert has_wash
def test_headline_in_body_column(self, mobile_page):
"""Headline stays within body column on mobile."""
mobile_page.wait_for_selector('.swipe-margins-enabled')
header = mobile_page.query_selector('header')
body_col = mobile_page.query_selector('.body-text')
assert header is not None
# Header should be inside or visually within body column
Implement: No CSS changes expected — verify existing mobile rules don’t
conflict with wash system. Add @media overrides only if needed.
Commit: “Verify illuminated print on mobile” (test-only if no changes needed)
Step 13: Integration Test
Test: Full-page smoke test on the Kropotkin article.
def test_kropotkin_article_renders(self, page):
"""Kropotkin funeral article loads with illuminated print styling."""
page.goto('/5921/2/13/kropotkins-funeral/')
page.wait_for_selector('.sidenotes-ready')
# Masthead has illuminated rule
assert page.query_selector('.masthead') is not None
# At least one washed margin box exists
washed = page.query_selector('.margin-box[class*="wc-mb-"]')
assert washed is not None
# SVG filter is present
assert page.query_selector('#wc-grain') is not None
Commit: “Add illuminated print integration test”
Execution Order
Steps 1–8 are CSS/template changes with no JS dependency. They can be committed incrementally and tested against any article.
Step 9 (CSS wash classes) must precede step 10 (JS wash assignment).
Steps 11–12 are independent polish.
Step 13 is the final smoke test.
[1] Tokens ─┐
[2] Background ─┤
[3] Masthead ─┤
[4] Header ─┤
[5] Initial ─┤ (CSS + template, independent)
[6] Links ─┤
[7] Rules ─┤
[8] SVG filter ─┘
│
[9] Wash CSS ──→ [10] JS wash assignment
│
[11] Manicules ─┐
[12] Mobile ─┤ (polish, independent)
[13] Integration ─┘
Files Modified (summary)
| File | Steps |
|---|---|
assets/css/almanack.css |
1, 2, 3, 4, 5, 6, 7, 9, 11 |
src/almnck/templates/base.html |
8 |
src/almnck/templates/units/article.html |
5 |
src/almnck/templates/partials/header.html |
4 |
assets/js/sidenotes.js |
10 |
src/tests/test_illuminated_print.py |
1–13 (new) |