From d8229bc2dc3e7a9d392dcb5d89bd4f99682e3f22 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 30 Jun 2026 01:00:39 -0400 Subject: feat(theme-studio): register nov-reading structural faces and color the preview The nov reading view app gains six faces: a heading and link accent for each of the sepia, dark, and light palettes, seeded to match the module defaults. The book-page preview now draws each page's title in its palette's heading face and an inline phrase in its link face, iterating only the base palette faces so the structural faces color a page rather than getting blank pages of their own. --- scripts/theme-studio/face_data.py | 13 +++++++++++-- scripts/theme-studio/previews.js | 15 ++++++++++++--- scripts/theme-studio/theme-studio.html | 17 +++++++++++++---- 3 files changed, 36 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/theme-studio/face_data.py b/scripts/theme-studio/face_data.py index f6c0b5ca9..3eb471d7f 100644 --- a/scripts/theme-studio/face_data.py +++ b/scripts/theme-studio/face_data.py @@ -346,11 +346,20 @@ GNUS_SEED={ # nov-reading: the EPUB reading-view palettes (config faces, not a package). Each # is the buffer-local default bg+fg for a reading mode; seeded with the module's # starting hex so the studio shows sepia/dark/light from the first render. -NOV_READING_FACES=("cj/nov-reading-sepia cj/nov-reading-dark cj/nov-reading-light").split() +NOV_READING_FACES=("cj/nov-reading-sepia cj/nov-reading-dark cj/nov-reading-light " + "cj/nov-reading-sepia-heading cj/nov-reading-sepia-link " + "cj/nov-reading-dark-heading cj/nov-reading-dark-link " + "cj/nov-reading-light-heading cj/nov-reading-light-link").split() NOV_READING_SEED={ "cj/nov-reading-sepia":{"bg":"#1f1b16","fg":"#c9b187"}, "cj/nov-reading-dark":{"bg":"#15140f","fg":"#cfc8b8"}, - "cj/nov-reading-light":{"bg":"#ece3cf","fg":"#2a2622"}} + "cj/nov-reading-light":{"bg":"#ece3cf","fg":"#2a2622"}, + "cj/nov-reading-sepia-heading":{"fg":"#e6c98a"}, + "cj/nov-reading-sepia-link":{"fg":"#c98f5a","underline":True}, + "cj/nov-reading-dark-heading":{"fg":"#e8e0cc"}, + "cj/nov-reading-dark-link":{"fg":"#8fb0c4","underline":True}, + "cj/nov-reading-light-heading":{"fg":"#5a3d28"}, + "cj/nov-reading-light-link":{"fg":"#8a5a2a","underline":True}} # The bespoke package apps, single-sourced here. Each row is # (key, label, preview, FACES, prefix, SEED); add an app by adding one row. diff --git a/scripts/theme-studio/previews.js b/scripts/theme-studio/previews.js index e6d740eea..658da3700 100644 --- a/scripts/theme-studio/previews.js +++ b/scripts/theme-studio/previews.js @@ -476,20 +476,29 @@ function novReadingPage(a,face,label){ const cls=isLocateOnPane(a,curApp())?' class="locate-onpane"':''; const title=attresc(formatLocateTitle(locateFaceMeta(a,face,LOCATE_REG))); const page=ofs(a,face)+";width:34em;max-width:100%;border-radius:6px;box-shadow:0 1px 8px #0007;padding:24px 30px 18px;font:13pt/1.62 Georgia,'Times New Roman',serif"; + // Structural faces recolor the title (heading) and an inline link, derived by + // suffix from the palette face so tuning them in the studio repaints the page. + const hface=face+'-heading',lface=face+'-link'; + const htitle=attresc(formatLocateTitle(locateFaceMeta(a,hface,LOCATE_REG))); + const hfg=effFg(pkgEffFg(a,hface)); return `
` +`
Nathaniel Hawthorne · Twice-Told Tales
` - +`
Dr. Heidegger’s Experiment
` + +`
Dr. Heidegger’s Experiment
` +`

` +`T` +`hat very singular man, old Dr. Heidegger, once invited four venerable friends to meet him in his study. There were three white-bearded gentlemen, Mr. Medbourne, Colonel Killigrew, and Mr. Gascoigne, and a withered gentlewoman whose name was the Widow Wycherly.

` - +`

They were all melancholy old creatures, who had been unfortunate in life, and whose greatest misfortune it was that they were not long ago in their graves. If the powder be genuine, said the doctor, the rose of half a century should bloom again.

` + +`

They were all melancholy old creatures, who had been unfortunate in life. If the powder be genuine, said the doctor, `+os(a,lface,'the rose of half a century')+` should bloom again.

` +`
${esc(label)} · 12
` +`
`;} function renderNovReadingPreview(){ const a='nov-reading',faces=(APPS[a]&&APPS[a].faces)||[]; if(!faces.length)return genericPreview(a); + // One book page per base palette (the bg/fg faces); the per-palette heading + // and link faces color the title and inline link within each page rather than + // getting a page of their own. + const base=faces.filter(r=>!/-heading$|-link$/.test(r[0])); let h='
'; - for(const row of faces)h+=novReadingPage(a,row[0],row[1]); + for(const row of base)h+=novReadingPage(a,row[0],row[1]); return h+'
';} function renderSlackPreview(){const a='slack',L=[]; L.push(os(a,'slack-room-info-title-room-name-face','#general')+' '+os(a,'slack-room-info-title-face','Acme Workspace')); diff --git a/scripts/theme-studio/theme-studio.html b/scripts/theme-studio/theme-studio.html index e3d88a46a..85145fb28 100644 --- a/scripts/theme-studio/theme-studio.html +++ b/scripts/theme-studio/theme-studio.html @@ -297,7 +297,7 @@