@bytechain.cn/colamd-themes 0.3.1 → 0.5.0

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.
Files changed (100) hide show
  1. package/.claude/skills/colamd-themes-preview.skill.md +333 -0
  2. package/.claude/skills/colamd-themes.skill.md +10 -0
  3. package/.dsh/skills/colamd-themes/SKILL.md +14 -0
  4. package/.github/supported-topics.yml +17 -0
  5. package/.hermes/skills/tools/colamd-themes/SKILL.md +14 -0
  6. package/.openclaw/skills/colamd-themes/SKILL.md +1 -146
  7. package/.opencode/skills/colamd-themes/SKILL.md +17 -0
  8. package/.trae/rules/colamd-themes.md +0 -145
  9. package/CHANGELOG.md +318 -240
  10. package/DSH_SUPPORT_SUMMARY.md +87 -0
  11. package/README.md +414 -384
  12. package/README_CN.md +412 -384
  13. package/RELEASENOTE.md +541 -365
  14. package/bytechain.cn-colamd-themes-0.5.0.tgz +0 -0
  15. package/dist/cli.js +272 -32
  16. package/dist/cli.js.map +1 -1
  17. package/dist/color-utils.d.ts +1 -0
  18. package/dist/color-utils.js +25 -6
  19. package/dist/color-utils.js.map +1 -1
  20. package/dist/extractors/pdf-extractor.js +6 -1
  21. package/dist/extractors/pdf-extractor.js.map +1 -1
  22. package/dist/extractors/url-extractor.d.ts +0 -4
  23. package/dist/extractors/url-extractor.js +13 -126
  24. package/dist/extractors/url-extractor.js.map +1 -1
  25. package/dist/generator.d.ts +1 -1
  26. package/dist/generator.js +32 -11
  27. package/dist/generator.js.map +1 -1
  28. package/dist/models.d.ts +5 -4
  29. package/dist/models.js +2 -3
  30. package/dist/models.js.map +1 -1
  31. package/dist/renderer.d.ts +4 -2
  32. package/dist/renderer.js +68 -25
  33. package/dist/renderer.js.map +1 -1
  34. package/dist/templates/template.css +220 -498
  35. package/dist/templates/theme-paradigm.md +530 -658
  36. package/dist/templates/theme-template.hbs +256 -370
  37. package/dist/theme-store.js +19 -3
  38. package/dist/theme-store.js.map +1 -1
  39. package/dist/utils/document-paradigm.d.ts +12 -0
  40. package/dist/utils/document-paradigm.js +109 -0
  41. package/dist/utils/document-paradigm.js.map +1 -0
  42. package/dist/validators.d.ts +4 -1
  43. package/dist/validators.js +115 -1
  44. package/dist/validators.js.map +1 -1
  45. package/mcp-server/dist/index.d.ts +13 -0
  46. package/mcp-server/dist/index.d.ts.map +1 -0
  47. package/mcp-server/dist/index.js +0 -0
  48. package/mcp-server/dist/index.js.map +1 -0
  49. package/mcp-server/package-lock.json +1759 -0
  50. package/mcp-server/package.json +24 -0
  51. package/mcp-server/src/index.ts +0 -0
  52. package/mcp-server/tsconfig.json +19 -0
  53. package/package.json +54 -36
  54. package/skills/build-skills.sh +30 -5
  55. package/skills/colamd-themes/SKILL.md +180 -148
  56. package/src/cli.ts +474 -217
  57. package/src/color-systems.ts +289 -289
  58. package/src/color-utils.ts +137 -120
  59. package/src/contrast.ts +66 -66
  60. package/src/docx-style-paradigm.ts +811 -811
  61. package/src/export-cli.ts +356 -356
  62. package/src/extractors/base.ts +8 -8
  63. package/src/extractors/docx-extractor.ts +417 -417
  64. package/src/extractors/pdf-extractor.ts +533 -527
  65. package/src/extractors/url-extractor.ts +846 -981
  66. package/src/generator.ts +197 -169
  67. package/src/index.ts +29 -29
  68. package/src/models.ts +212 -212
  69. package/src/renderer.ts +332 -288
  70. package/src/templates/template.css +220 -498
  71. package/src/templates/theme-paradigm.md +530 -658
  72. package/src/templates/theme-template.hbs +256 -370
  73. package/src/theme-store.ts +185 -170
  74. package/src/types/pdf-parse.d.ts +12 -12
  75. package/src/utils/cli-utils.ts +84 -84
  76. package/src/utils/document-paradigm.ts +118 -0
  77. package/src/validators.ts +298 -176
  78. package/themes/academic-paper-pt.css +353 -1805
  79. package/themes/academic-paper.css +350 -1099
  80. package/themes/academic-style.css +342 -2430
  81. package/themes/colly.css +256 -370
  82. package/themes/elegant.css +288 -671
  83. package/themes/forest-ink.css +240 -664
  84. package/themes/guizang.css +250 -732
  85. package/themes/hermes-security.css +279 -0
  86. package/themes/meeting-minutes.css +256 -370
  87. package/themes/pixso-design.css +278 -1261
  88. package/themes/salvator-blog.css +256 -370
  89. package/themes/shimo-theme.css +256 -0
  90. package/themes/swiss-design.css +285 -746
  91. package/themes/template.css +220 -498
  92. package/themes/trae-blue.css +280 -737
  93. package/themes/word-contract.css +249 -0
  94. package/themes-preview/demo-content.md +187 -187
  95. package/tsconfig.json +18 -18
  96. package/src/mermaid-presets.ts +0 -142
  97. package/themes/swiss-design copy.css +0 -746
  98. package/themes-preview/colly-preview.html +0 -623
  99. package/themes-preview/meeting-minutes-preview.html +0 -625
  100. package/themes-preview/salvator-blog-preview.html +0 -623
@@ -2,149 +2,4 @@
2
2
 
3
3
  When the user asks to create, validate, export, or manage ColaMD themes, use the following CLI tool:
4
4
 
5
- Generate, validate, export, and manage ColaMD v3.0 paradigm CSS themes. Extract formatting from URLs, DOCX, or PDF sources; export Markdown to standalone HTML/PDF with themes applied; batch export; manage theme configuration.
6
5
 
7
- ## Prerequisites
8
-
9
- - Node.js ≥ 18
10
- - Project root: run `npm install && npm run build` before first use
11
- - Or run directly: `npx tsx src/cli.ts <command>`
12
-
13
- ## Commands
14
-
15
- ### Theme extraction
16
-
17
- ```bash
18
- colamd-themes from-url <URL> [options]
19
- colamd-themes from-docx <file> [options]
20
- colamd-themes from-pdf <file> [options]
21
- colamd-themes extract <source> [options]
22
- ```
23
-
24
- ### Export to HTML / PDF
25
-
26
- ```bash
27
- colamd-themes export-html <input.md> -t <theme> -o <output.html>
28
- colamd-themes export-pdf <input.md> -t <theme> -o <output.pdf>
29
- colamd-themes export <inputs...> --format html|pdf -t <theme> -d <dir>
30
- ```
31
-
32
- ### Theme management
33
-
34
- ```bash
35
- colamd-themes set-theme <name> --default
36
- colamd-themes set-theme <name> --css <file>
37
- colamd-themes set-theme <name> --css <file> --default
38
- colamd-themes set-theme <name> --remove
39
- ```
40
-
41
- ### Inspection
42
-
43
- ```bash
44
- colamd-themes color-systems [-j]
45
- colamd-themes mermaid-presets [-j]
46
- colamd-themes list [-d <dir>]
47
- colamd-themes validate <file.css>
48
- ```
49
-
50
- ## Options
51
-
52
- ### Extract options
53
-
54
- | Flag | Description |
55
- |------|-------------|
56
- | `-n, --name` | Theme name |
57
- | `-o, --output` | Output CSS file path |
58
- | `-d, --themes-dir` | Themes directory (default: `themes/`) |
59
- | `-c, --color-system` | Force a color system |
60
- | `-m, --mermaid-preset` | Force a Mermaid preset (light/dark/elegant) |
61
- | `-A, --auto-match` | Auto-match color system and Mermaid preset |
62
-
63
- ### Export options
64
-
65
- | Flag | Description |
66
- |------|-------------|
67
- | `-t, --theme` | Theme: built-in name, custom name, or `.css` file path |
68
- | `-o, --output` | Output file path |
69
- | `-d, --output-dir` | Output directory for batch export |
70
- | `--format` | Batch: `html` or `pdf`; PDF: `A4`, `Letter`, `A3` |
71
-
72
- ## Theme Resolution
73
-
74
- `-t, --theme` accepts:
75
- 1. **Built-in**: `light`, `dark`, `elegant`, `newsprint`
76
- 2. **Custom registered**: name set via `set-theme --css`
77
- 3. **File path**: any `.css` file on disk
78
-
79
- Config: `~/.colamd-themes/config.json`
80
-
81
- ## Color Systems (15 schemes)
82
-
83
- | Family | Schemes |
84
- |--------|---------|
85
- | 莫兰迪 (Morandi) | misty-rose, sage-green, dusky-blue |
86
- | 马卡龙 (Macaron) | strawberry, mint, lavender |
87
- | 北欧 (Nordic) | fjord-blue, pine-green, cloud-grey |
88
- | 复古 (Vintage) | amber, burgundy, forest |
89
- | 薄荷绿 (Mint) | matcha, spearmint, seafoam |
90
-
91
- ## Mermaid Presets
92
-
93
- `light` — cool accent on light bg | `dark` — dark bg | `elegant` — warm accent on light bg
94
-
95
- ## Workflow Examples
96
-
97
- ### Create theme from source
98
-
99
- ```bash
100
- colamd-themes extract <source> --name "my-theme" --auto-match
101
- ```
102
-
103
- ### Export with theme
104
-
105
- ```bash
106
- colamd-themes export-html doc.md -t elegant -o output.html
107
- colamd-themes export-pdf doc.md -t my-brand -o output.pdf
108
- ```
109
-
110
- ### Batch export
111
-
112
- ```bash
113
- colamd-themes export docs/ --format pdf -t dark -d output/
114
- ```
115
-
116
- ### Validate theme
117
-
118
- ```bash
119
- colamd-themes validate themes/my-theme.css
120
- ```
121
-
122
- ## Rendering Pipeline
123
-
124
- Export uses Puppeteer (headless Chromium) with `@bytechain.cn/colamd/renderer`:
125
-
126
- 1. Local HTTP server serves renderer ESM bundle (avoids CORS)
127
- 2. Puppeteer navigates to server page (same-origin)
128
- 3. `createColaMDEditor({ editable: false })` initializes Milkdown editor
129
- 4. `applyTheme(name, customCSS?)` sets theme
130
- 5. `setMarkdown(content)` loads document
131
- 6. `ensureAllPluginsRendered()` waits for mermaid/KaTeX
132
- 7. `buildExportHTML()` → standalone HTML with embedded CSS
133
- 8. For PDF: `emulateMediaType('screen')` + `page.pdf()`
134
-
135
- ## v3.0 Paradigm Constraints
136
-
137
- - No bare hex colors in selectors — use `var(--seed-*)`
138
- - No bare font sizes — use `var(--font-*)`
139
- - No Mermaid SVG selectors (handled by built-in `variables.css`)
140
- - `!important` only in `@media print`
141
- - Generated CSS ≤ 300 lines
142
- - Font stacks must include CJK fallback and end with generic family
143
-
144
- ## Architecture
145
-
146
- ```
147
- Source → Extractor → ThemeStyle → Color System + Mermaid Preset + Validators → CSS
148
-
149
- Markdown → Puppeteer + ColaMD Renderer → HTML / PDF
150
- ```