@bytechain.cn/colamd-themes 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -4
- package/package.json +1 -1
- package/skills/colamd-themes/SKILL.md +86 -1
- package/themes/8-bit-orbit.css +817 -0
- package/themes/README.md +69 -0
- package/themes/biennale-yellow.css +577 -0
- package/themes/block-frame.css +774 -0
- package/themes/blue-professional.css +741 -0
- package/themes/bold-poster.css +794 -0
- package/themes/broadside.css +837 -0
- package/themes/capsule.css +767 -0
- package/themes/cartesian.css +584 -0
- package/themes/cobalt-grid.css +632 -0
- package/themes/coral.css +699 -0
- package/themes/creative-mode.css +642 -0
- package/themes/daisy-days.css +1052 -0
- package/themes/editorial-forest.css +796 -0
- package/themes/editorial-tri-tone.css +811 -0
- package/themes/emerald-editorial.css +683 -0
- package/themes/grove.css +623 -0
- package/themes/long-table.css +782 -0
- package/themes/mat.css +848 -0
- package/themes/monochrome.css +782 -0
- package/themes/neo-grid-bold.css +838 -0
- package/themes/peoples-platform.css +843 -0
- package/themes/pin-and-paper.css +700 -0
- package/themes/pink-script-dark.css +648 -0
- package/themes/pink-script.css +290 -0
- package/themes/playful.css +774 -0
- package/themes/raw-grid.css +814 -0
- package/themes/retro-windows.css +767 -0
- package/themes/retro-zine.css +814 -0
- package/themes/sakura-chroma.css +775 -0
- package/themes/scatterbrain.css +726 -0
- package/themes/signal.css +872 -0
- package/themes/soft-editorial.css +788 -0
- package/themes/stencil-tablet.css +922 -0
- package/themes/studio.css +767 -0
- package/themes/vellum.css +723 -0
package/README.md
CHANGED
|
@@ -34,10 +34,11 @@ After installation, open a `.md` file and run **ColaView MD: Show Preview** from
|
|
|
34
34
|
### Theme Extraction
|
|
35
35
|
|
|
36
36
|
- **URL** — fetch a web page, parse its CSS rules (via `css-tree`), resolve inline styles with specificity calculation, and derive a coherent theme palette
|
|
37
|
+
- **Local HTML template (`from-html`, v0.6.1+)** — extract from a local `.html` file; a sibling `template.json` (when present) supplies authoritative metadata (name, tagline, fonts, scheme, mood, density). Colors come from the template's `:root` custom properties via semantic-name matching with luminance/saturation heuristics as fallback; the palette is sanitized to satisfy the paradigm's luminance ordering (SL-04) and contrast rules (CR-02)
|
|
37
38
|
- **DOCX** — read Word document styles (H1–H6, tables, code blocks) via mammoth, map to theme variables
|
|
38
39
|
- **PDF** — extract typography metadata from PDF text using multi-layer heuristic analysis
|
|
39
|
-
- **Auto‑detect** — `extract` command automatically routes to the right extractor
|
|
40
|
-
- **PPT styling (`--ppt`, v0.6.0+, optional)** — extraction can also emit the `--slide-*` token section (ColaMD 2.7.13 slide layouts) into the generated theme. Presets mirror upstream voices: `serif` (magazine default), `sans` (Notion-like), `mono` (Writer-like)
|
|
40
|
+
- **Auto‑detect** — `extract` command automatically routes to the right extractor (local HTML, URL, DOCX, PDF)
|
|
41
|
+
- **PPT styling (`--ppt`, v0.6.0+, optional)** — extraction can also emit the `--slide-*` token section (ColaMD 2.7.13 slide layouts) into the generated theme. Presets mirror upstream voices: `serif` (magazine default), `sans` (Notion-like), `mono` (Writer-like). Since v0.6.1, `from-html` auto-detects the preset from the template's display font and, when the source provides design hints, derives a **full per-layout token set** (24 tokens): cover/section/closing title ladder from the template's own type scale, page title / KPI / quote / kicker / chrome / page padding tuned by mood (bold/quiet/tech), density, formality and scheme. Themes without design hints keep the brand-voice-only output
|
|
41
42
|
|
|
42
43
|
### Markdown → PPT Markdown (v0.6.0+)
|
|
43
44
|
|
|
@@ -220,11 +221,27 @@ cthemes from-docx report.docx --name corporate-theme
|
|
|
220
221
|
cthemes from-pdf paper.pdf --name academic-theme
|
|
221
222
|
```
|
|
222
223
|
|
|
224
|
+
### Extract from a local HTML template (v0.6.1+)
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# A sibling template.json (name/tagline/typography/scheme/mood) is used when present
|
|
228
|
+
cthemes from-html templates/vellum/template.html -n vellum --ppt -o themes/vellum.css
|
|
229
|
+
|
|
230
|
+
# Batch: extract every template in a directory (--ppt with no value trusts the
|
|
231
|
+
# preset auto-detected from each template's display font)
|
|
232
|
+
Get-ChildItem templates -Directory | ForEach-Object {
|
|
233
|
+
cthemes from-html "$($_.FullName)\template.html" -n $_.Name --ppt -o "themes/$($_.Name).css"
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
223
237
|
### Extract with PPT slide styling (optional, off by default)
|
|
224
238
|
|
|
225
239
|
```bash
|
|
226
240
|
# Also emit --slide-* tokens with the sans preset (serif | sans | mono)
|
|
227
241
|
cthemes from-url "https://example.com" --name my-brand --ppt sans
|
|
242
|
+
|
|
243
|
+
# --ppt with no preset: keep the extractor's auto-detected preset (from-html templates)
|
|
244
|
+
cthemes from-html template.html --ppt
|
|
228
245
|
```
|
|
229
246
|
|
|
230
247
|
### Convert Markdown into slide-deck Markdown
|
|
@@ -318,8 +335,9 @@ cthemes set-theme my-brand --remove
|
|
|
318
335
|
|---------|-------------|
|
|
319
336
|
| `from-url <url>` | Extract theme from a web page URL |
|
|
320
337
|
| `from-docx <file>` | Extract theme from a .docx document |
|
|
338
|
+
| `from-html <file>` | Extract theme from a local HTML file (sibling `template.json` used as metadata when present) |
|
|
321
339
|
| `from-pdf <file>` | Extract theme from a PDF document |
|
|
322
|
-
| `extract <source>` | Auto-detect source type and extract theme |
|
|
340
|
+
| `extract <source>` | Auto-detect source type (local HTML / URL / .docx / .pdf) and extract theme |
|
|
323
341
|
| `to-slides <input>` | Convert a Markdown document into slide-deck Markdown (auto-inferred layouts) |
|
|
324
342
|
| `color-systems` | List 15 built-in color systems |
|
|
325
343
|
| `list` | List all generated themes |
|
|
@@ -338,7 +356,7 @@ cthemes set-theme my-brand --remove
|
|
|
338
356
|
| `-d, --themes-dir` | Themes directory (default: `themes/`) |
|
|
339
357
|
| `-c, --color-system` | Force a color system |
|
|
340
358
|
| `-A, --auto-match` | Auto-match a color system from the extracted palette |
|
|
341
|
-
| `--ppt [style]` | Also emit PPT `--slide-*` tokens (2.7.13 slides); optional preset `serif` (default) / `sans` / `mono`. Off by default |
|
|
359
|
+
| `--ppt [style]` | Also emit PPT `--slide-*` tokens (2.7.13 slides); optional preset `serif` (default) / `sans` / `mono`. Off by default. A valueless `--ppt` keeps the preset auto-detected by the extractor (from-html templates) |
|
|
342
360
|
|
|
343
361
|
### to-slides options
|
|
344
362
|
|
package/package.json
CHANGED
|
@@ -14,11 +14,21 @@ Generate, validate, export, and manage ColaMD **2.7 contract** CSS themes (2.7.1
|
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
colamd-themes from-url <URL> [options]
|
|
17
|
+
colamd-themes from-html <file> [options]
|
|
17
18
|
colamd-themes from-docx <file> [options]
|
|
18
19
|
colamd-themes from-pdf <file> [options]
|
|
19
20
|
colamd-themes extract <source> [options]
|
|
20
21
|
```
|
|
21
22
|
|
|
23
|
+
`from-html` extracts from a **local HTML file** (v0.6.1+). A sibling
|
|
24
|
+
`template.json` — when present — supplies authoritative metadata: slug/tagline
|
|
25
|
+
as theme name/description, `typography.display/body/mono` (+ `serif_cn` /
|
|
26
|
+
`sans_cn`) as CJK-safe font stacks, `scheme`/`density`/`formality`/`mood` as
|
|
27
|
+
slide design hints. Colors come from the template's `:root` custom properties
|
|
28
|
+
(semantic-name matching first, luminance/saturation heuristics as fallback);
|
|
29
|
+
the palette is sanitized to satisfy the paradigm's luminance ordering (SL-04)
|
|
30
|
+
and contrast rules (CR-02). `extract` auto-detects local `.html/.htm` too.
|
|
31
|
+
|
|
22
32
|
### Export to HTML / PDF
|
|
23
33
|
|
|
24
34
|
```bash
|
|
@@ -64,7 +74,7 @@ colamd-themes validate <file.css | file.md>
|
|
|
64
74
|
| `-d, --themes-dir` | Themes directory (default: `themes/`) |
|
|
65
75
|
| `-c, --color-system` | Force a color system |
|
|
66
76
|
| `-A, --auto-match` | Auto-match a color system from the extracted palette |
|
|
67
|
-
| `--ppt [style]` | Also emit PPT `--slide-*` tokens (2.7.13 slides); optional preset `serif` (default) / `sans` / `mono`. Off by default |
|
|
77
|
+
| `--ppt [style]` | Also emit PPT `--slide-*` tokens (2.7.13 slides); optional preset `serif` (default) / `sans` / `mono`. Off by default. A valueless `--ppt` keeps the preset auto-detected by the extractor (from-html templates) |
|
|
68
78
|
|
|
69
79
|
### Export options
|
|
70
80
|
|
|
@@ -222,6 +232,7 @@ colamd-themes from-url <URL> -n my-brand --ppt sans # presets: serif | sans |
|
|
|
222
232
|
```
|
|
223
233
|
|
|
224
234
|
- serif = 上游杂志衬线默认;sans = Notion 气质(无衬线、居中封面);mono = Writer 气质(等宽标题)。品牌层只派生 `--slide-title-font` / `--slide-mono` / `--slide-title-weight`,版式字号阶梯保持上游默认。
|
|
235
|
+
- **v0.6.1 全量版式令牌**:`from-html` 模板来源提供设计提示(`--sz-*` 字号阶梯 + template.json 的 mood/density/formality/scheme)时,生成 **24 个按页类型定制的令牌**——封面/章节/收页字号阶梯取自模板 display/body 比例,页标题 / KPI / 引言 / kicker / chrome / 页边距按气质(bold/quiet/tech)与密度调校;`--ppt` 不带值时信任按 display 字体自动判定的预设。无设计提示的主题保持仅品牌层输出(向后兼容)。
|
|
225
236
|
- 自定义主题 CSS 在 slides.css 之后加载,`:root` 同权重后到先赢;不要写 `body.theme-custom`(文档契约死选择器)。
|
|
226
237
|
- 手写主题里的幻灯片规则须遵守:**SLIDE-01** (SHOULD) 只用已知令牌;**SLIDE-02** (MUST_NOT) `.cm-md-page-*` / `.cm-md-slide-*` / `.slide-chrome|foot|ghost` 必须包裹在 `body.presenting` 或 `body.slides-printing` 作用域下(裸写污染编辑视图);**SLIDE-03** (SHOULD) 标题字体栈含中文字族并以 generic family 结尾。
|
|
227
238
|
- 平台需 ≥ 2.7.13 才消费这些令牌(compat 行「幻灯片版式」);旧平台下令牌惰性。导出的 HTML/PDF 仍为文档式排版,放映版式在 ColaMD 应用内查看。
|
|
@@ -239,6 +250,52 @@ colamd-themes from-url <URL> -n my-brand --ppt sans # presets: serif | sans |
|
|
|
239
250
|
- Generated CSS ≤ 300 lines
|
|
240
251
|
- Font stacks must include CJK fallback and end with generic family
|
|
241
252
|
|
|
253
|
+
## Reference-Template Refinement (page-by-page replication)
|
|
254
|
+
|
|
255
|
+
Use when the task is to reproduce a multi-page PPT template
|
|
256
|
+
(`beautiful-html-templates/templates/<slug>/template.html`) as a ColaMD 2.7.13
|
|
257
|
+
slide theme (`themes/<slug>.css`) with strict fidelity. Full methodology:
|
|
258
|
+
`docs/slide-theme-replication.md`. Reference themes: `themes/biennale-yellow.css`
|
|
259
|
+
(header / token / section-1.6 structure) and `themes/pin-and-paper.css`
|
|
260
|
+
(page-background layer chain).
|
|
261
|
+
|
|
262
|
+
### Workflow
|
|
263
|
+
|
|
264
|
+
1. **Read the template**: `:root` palette + fonts, then every page section's
|
|
265
|
+
background / title / subtitle / body / object box (padding, radius, shadow).
|
|
266
|
+
2. **Map pages to layouts**: cover / section / agenda / kpi / timeline / steps /
|
|
267
|
+
matrix / two-col / figure / quote / closing. A mapping supplied by the user
|
|
268
|
+
always wins over your own inference; record it in the file header and §1.5.
|
|
269
|
+
3. **Convert**: 26px per em (presenting base `clamp(17px,1.35vw,26px)` @1920×1080);
|
|
270
|
+
template px ÷ 26, taking clamp() landing points at 1920. For inline children,
|
|
271
|
+
fix the li base size first, then divide by that scale.
|
|
272
|
+
4. **Write**: §1.5 `--slide-*` tokens (formula in every comment) → §1.6 scoped
|
|
273
|
+
per-layout rules (composite selectors, SLIDE-02 scopes) → §2/§3 mirrored
|
|
274
|
+
editor/export rules → §4 print.
|
|
275
|
+
5. **Validate**: `npx tsx src/cli.ts validate themes/<slug>.css` must report
|
|
276
|
+
contract pass + slide-layout support + zero SLIDE- / SLIDES- / CSS-03
|
|
277
|
+
findings. Paradigm errors are allowed only for identity items documented in
|
|
278
|
+
the file header.
|
|
279
|
+
|
|
280
|
+
### Fidelity checklist (walk every page)
|
|
281
|
+
|
|
282
|
+
- **Background**: swapped-background pages need the full 5-layer chain; ordinary
|
|
283
|
+
pages must not paint a page-level background.
|
|
284
|
+
- **Title**: family / weight / size / line-height / tracking / color / alignment /
|
|
285
|
+
max-width.
|
|
286
|
+
- **Subtitle & kicker**: size, tracking, transform, opacity.
|
|
287
|
+
- **Body**: li base scale + `.cm-md-strong` row title + `.cm-md-listmark`
|
|
288
|
+
number/date; redraw card borders instead of keeping capsule defaults.
|
|
289
|
+
- **Position**: page-level vertical centering, page padding, object-box width
|
|
290
|
+
(border-box, padding included), inter-row gaps.
|
|
291
|
+
|
|
292
|
+
### Batch runs
|
|
293
|
+
|
|
294
|
+
One theme = one file, so templates can be dispatched in parallel (max 5
|
|
295
|
+
concurrent sub-agents). After each batch verify the file's size/mtime actually
|
|
296
|
+
changed — an unchanged file means a lost run, so re-dispatch it. Run `validate`
|
|
297
|
+
once over every theme at the end.
|
|
298
|
+
|
|
242
299
|
## CSS Pitfall Quick Reference
|
|
243
300
|
|
|
244
301
|
> When adjusting themes, follow these rules strictly. Reference `themes/template.css` and the upstream examples in `ColaMD-extend/resources/templates/themes/`.
|
|
@@ -267,6 +324,34 @@ colamd-themes from-url <URL> -n my-brand --ppt sans # presets: serif | sans |
|
|
|
267
324
|
|
|
268
325
|
**Pitfall:** Writing `themeVariables` or Mermaid `classDef` in the theme. **Correct:** override `--pele-*` on `:root`; the SVG reads them at render time.
|
|
269
326
|
|
|
327
|
+
### 7. Layout class and line-role class share one div
|
|
328
|
+
|
|
329
|
+
**Pitfall:** `.cm-md-slide-quote .cm-md-blockquote` (descendant form). **Correct:** `.cm-md-slide-quote.cm-md-blockquote` — the layout class is a line decoration stamped on the same div, so upstream descendant selectors miss in the editor DOM.
|
|
330
|
+
|
|
331
|
+
### 8. Page-level vertical centering
|
|
332
|
+
|
|
333
|
+
**Pitfall:** The template centers every page (`.slide` = flex column + `justify-content:center`), while upstream only centers cover / section / closing / two-col. **Correct:** single-column layouts get `display:flex; flex-direction:column; justify-content:safe center; min-height:92vh`. Card grids (kpi / matrix / steps / timeline) must keep inline-block flow, so use `flex-wrap:wrap` + `align-content:safe center`, cards `flex:0 0 auto`, every other line `flex:0 0 100%`; also `display:none` the page directive and zero the first line's top padding.
|
|
334
|
+
|
|
335
|
+
### 9. Per-item color rotation
|
|
336
|
+
|
|
337
|
+
**Pitfall:** Painting every card with the first card's color. **Correct:** target index N with `:nth-child(2 of .cm-md-slide-kpi.cm-md-li) .cm-md-strong` (Chrome 111+); older engines fall back to the base color.
|
|
338
|
+
|
|
339
|
+
### 10. No commas inside `:nth-child(... of ...)`
|
|
340
|
+
|
|
341
|
+
**Pitfall:** `:nth-child(1 of A, B)` — the validator splits the selector at the comma and flags the second half as unscoped (SLIDE-02). **Correct:** one selector per rule, e.g. `:nth-child(1 of .cm-md-slide-section.cm-md-li)`.
|
|
342
|
+
|
|
343
|
+
### 11. Object-box width is border-box
|
|
344
|
+
|
|
345
|
+
**Pitfall:** A template `max-width:750px` already includes its 56px padding; drawing the rows at `max-width:866px` makes the box 116px too wide. **Correct:** keep the template's outer width and subtract padding from the content width — never add.
|
|
346
|
+
|
|
347
|
+
### 12. Upstream `.cm-md-li` margins
|
|
348
|
+
|
|
349
|
+
**Pitfall:** Adding `padding-block` for list gaps while upstream keeps `margin:0.45em 0` turns an 18px gap into 29px. **Correct:** zero `margin-block` first; detect first/last rows with `:has(~ .cm-md-slide-x.cm-md-li)` (not `+`) so blank lines do not break detection.
|
|
350
|
+
|
|
351
|
+
### 13. Verify before inventing
|
|
352
|
+
|
|
353
|
+
**Pitfall:** Assuming a decorative or motion layer exists on a page. **Correct:** full-text search the template first; when it is absent, say so in the header's "not replicated" note instead of inventing a layout.
|
|
354
|
+
|
|
270
355
|
## Architecture
|
|
271
356
|
|
|
272
357
|
```
|