@bytechain.cn/colamd-themes 0.3.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.
- package/.claude/skills/colamd-themes-preview.skill.md +333 -0
- package/.claude/skills/colamd-themes.skill.md +155 -0
- package/.hermes/skills/tools/colamd-themes/SKILL.md +159 -0
- package/.openclaw/skills/colamd-themes/SKILL.md +166 -0
- package/.opencode/skills/colamd-themes/SKILL.md +162 -0
- package/.trae/rules/colamd-themes.md +150 -0
- package/CHANGELOG.md +102 -0
- package/README.md +373 -0
- package/README_CN.md +373 -0
- package/RELEASENOTE.md +177 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +208 -0
- package/dist/cli.js.map +1 -0
- package/dist/color-systems.d.ts +17 -0
- package/dist/color-systems.js +251 -0
- package/dist/color-systems.js.map +1 -0
- package/dist/color-utils.d.ts +9 -0
- package/dist/color-utils.js +112 -0
- package/dist/color-utils.js.map +1 -0
- package/dist/contrast.d.ts +15 -0
- package/dist/contrast.js +63 -0
- package/dist/contrast.js.map +1 -0
- package/dist/docx-style-paradigm.d.ts +153 -0
- package/dist/docx-style-paradigm.js +640 -0
- package/dist/docx-style-paradigm.js.map +1 -0
- package/dist/export-cli.d.ts +10 -0
- package/dist/export-cli.js +266 -0
- package/dist/export-cli.js.map +1 -0
- package/dist/extractors/base.d.ts +6 -0
- package/dist/extractors/base.js +3 -0
- package/dist/extractors/base.js.map +1 -0
- package/dist/extractors/docx-extractor.d.ts +52 -0
- package/dist/extractors/docx-extractor.js +370 -0
- package/dist/extractors/docx-extractor.js.map +1 -0
- package/dist/extractors/pdf-extractor.d.ts +66 -0
- package/dist/extractors/pdf-extractor.js +430 -0
- package/dist/extractors/pdf-extractor.js.map +1 -0
- package/dist/extractors/url-extractor.d.ts +104 -0
- package/dist/extractors/url-extractor.js +761 -0
- package/dist/extractors/url-extractor.js.map +1 -0
- package/dist/generator.d.ts +4 -0
- package/dist/generator.js +71 -0
- package/dist/generator.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/mermaid-presets.d.ts +14 -0
- package/dist/mermaid-presets.js +122 -0
- package/dist/mermaid-presets.js.map +1 -0
- package/dist/models.d.ts +106 -0
- package/dist/models.js +92 -0
- package/dist/models.js.map +1 -0
- package/dist/renderer.d.ts +70 -0
- package/dist/renderer.js +204 -0
- package/dist/renderer.js.map +1 -0
- package/dist/templates/template.css +498 -0
- package/dist/templates/theme-paradigm.md +658 -0
- package/dist/templates/theme-template.hbs +370 -0
- package/dist/theme-store.d.ts +37 -0
- package/dist/theme-store.js +90 -0
- package/dist/theme-store.js.map +1 -0
- package/dist/validators.d.ts +26 -0
- package/dist/validators.js +144 -0
- package/dist/validators.js.map +1 -0
- package/package.json +36 -0
- package/skills/build-skills.sh +166 -0
- package/skills/colamd-themes/SKILL.md +148 -0
- package/src/cli.ts +200 -0
- package/src/color-systems.ts +289 -0
- package/src/color-utils.ts +120 -0
- package/src/contrast.ts +66 -0
- package/src/docx-style-paradigm.ts +811 -0
- package/src/export-cli.ts +301 -0
- package/src/extractors/base.ts +8 -0
- package/src/extractors/docx-extractor.ts +417 -0
- package/src/extractors/pdf-extractor.ts +527 -0
- package/src/extractors/url-extractor.ts +927 -0
- package/src/generator.ts +88 -0
- package/src/index.ts +29 -0
- package/src/mermaid-presets.ts +142 -0
- package/src/models.ts +212 -0
- package/src/renderer.ts +277 -0
- package/src/templates/template.css +498 -0
- package/src/templates/theme-paradigm.md +658 -0
- package/src/templates/theme-template.hbs +370 -0
- package/src/theme-store.ts +112 -0
- package/src/types/pdf-parse.d.ts +12 -0
- package/src/validators.ts +176 -0
- package/themes/.gitkeep +0 -0
- package/themes/academic-paper-pt.css +1805 -0
- package/themes/academic-paper.css +1099 -0
- package/themes/academic-style.css +2430 -0
- package/themes/colly.css +370 -0
- package/themes/elegant.css +671 -0
- package/themes/forest-ink.css +664 -0
- package/themes/guizang.css +732 -0
- package/themes/meeting-minutes.css +370 -0
- package/themes/pixso-design.css +1261 -0
- package/themes/salvator-blog.css +370 -0
- package/themes/swiss-design copy.css +746 -0
- package/themes/swiss-design.css +746 -0
- package/themes/template.css +498 -0
- package/themes/trae-blue.css +737 -0
- package/themes-preview/colly-preview.html +623 -0
- package/themes-preview/demo-content.md +187 -0
- package/themes-preview/meeting-minutes-preview.html +625 -0
- package/themes-preview/salvator-blog-preview.html +623 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: colamd-themes
|
|
3
|
+
name: ColaMD Themes
|
|
4
|
+
description: >
|
|
5
|
+
Generate, validate, export, and manage ColaMD v3.0 paradigm CSS themes.
|
|
6
|
+
Extract from URLs/DOCX/PDF; export Markdown to HTML/PDF; batch export.
|
|
7
|
+
version: "1.0.0"
|
|
8
|
+
icon: "\U0001F3A8"
|
|
9
|
+
author: bytechain
|
|
10
|
+
homepage: https://github.com/byteuser1977/ColaMD-themes
|
|
11
|
+
user-invocable: true
|
|
12
|
+
metadata:
|
|
13
|
+
openclaw:
|
|
14
|
+
os: [darwin, linux, win32]
|
|
15
|
+
clawdbot:
|
|
16
|
+
emoji: "\U0001F3A8"
|
|
17
|
+
requires:
|
|
18
|
+
bins: [node, npm]
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
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.
|
|
22
|
+
|
|
23
|
+
## Prerequisites
|
|
24
|
+
|
|
25
|
+
- Node.js ≥ 18
|
|
26
|
+
- Project root: run `npm install && npm run build` before first use
|
|
27
|
+
- Or run directly: `npx tsx src/cli.ts <command>`
|
|
28
|
+
|
|
29
|
+
## Commands
|
|
30
|
+
|
|
31
|
+
### Theme extraction
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
colamd-themes from-url <URL> [options]
|
|
35
|
+
colamd-themes from-docx <file> [options]
|
|
36
|
+
colamd-themes from-pdf <file> [options]
|
|
37
|
+
colamd-themes extract <source> [options]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Export to HTML / PDF
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
colamd-themes export-html <input.md> -t <theme> -o <output.html>
|
|
44
|
+
colamd-themes export-pdf <input.md> -t <theme> -o <output.pdf>
|
|
45
|
+
colamd-themes export <inputs...> --format html|pdf -t <theme> -d <dir>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Theme management
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
colamd-themes set-theme <name> --default
|
|
52
|
+
colamd-themes set-theme <name> --css <file>
|
|
53
|
+
colamd-themes set-theme <name> --css <file> --default
|
|
54
|
+
colamd-themes set-theme <name> --remove
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Inspection
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
colamd-themes color-systems [-j]
|
|
61
|
+
colamd-themes mermaid-presets [-j]
|
|
62
|
+
colamd-themes list [-d <dir>]
|
|
63
|
+
colamd-themes validate <file.css>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Options
|
|
67
|
+
|
|
68
|
+
### Extract options
|
|
69
|
+
|
|
70
|
+
| Flag | Description |
|
|
71
|
+
|------|-------------|
|
|
72
|
+
| `-n, --name` | Theme name |
|
|
73
|
+
| `-o, --output` | Output CSS file path |
|
|
74
|
+
| `-d, --themes-dir` | Themes directory (default: `themes/`) |
|
|
75
|
+
| `-c, --color-system` | Force a color system |
|
|
76
|
+
| `-m, --mermaid-preset` | Force a Mermaid preset (light/dark/elegant) |
|
|
77
|
+
| `-A, --auto-match` | Auto-match color system and Mermaid preset |
|
|
78
|
+
|
|
79
|
+
### Export options
|
|
80
|
+
|
|
81
|
+
| Flag | Description |
|
|
82
|
+
|------|-------------|
|
|
83
|
+
| `-t, --theme` | Theme: built-in name, custom name, or `.css` file path |
|
|
84
|
+
| `-o, --output` | Output file path |
|
|
85
|
+
| `-d, --output-dir` | Output directory for batch export |
|
|
86
|
+
| `--format` | Batch: `html` or `pdf`; PDF: `A4`, `Letter`, `A3` |
|
|
87
|
+
|
|
88
|
+
## Theme Resolution
|
|
89
|
+
|
|
90
|
+
`-t, --theme` accepts:
|
|
91
|
+
1. **Built-in**: `light`, `dark`, `elegant`, `newsprint`
|
|
92
|
+
2. **Custom registered**: name set via `set-theme --css`
|
|
93
|
+
3. **File path**: any `.css` file on disk
|
|
94
|
+
|
|
95
|
+
Config: `~/.colamd-themes/config.json`
|
|
96
|
+
|
|
97
|
+
## Color Systems (15 schemes)
|
|
98
|
+
|
|
99
|
+
| Family | Schemes |
|
|
100
|
+
|--------|---------|
|
|
101
|
+
| 莫兰迪 (Morandi) | misty-rose, sage-green, dusky-blue |
|
|
102
|
+
| 马卡龙 (Macaron) | strawberry, mint, lavender |
|
|
103
|
+
| 北欧 (Nordic) | fjord-blue, pine-green, cloud-grey |
|
|
104
|
+
| 复古 (Vintage) | amber, burgundy, forest |
|
|
105
|
+
| 薄荷绿 (Mint) | matcha, spearmint, seafoam |
|
|
106
|
+
|
|
107
|
+
## Mermaid Presets
|
|
108
|
+
|
|
109
|
+
`light` — cool accent on light bg | `dark` — dark bg | `elegant` — warm accent on light bg
|
|
110
|
+
|
|
111
|
+
## Workflow Examples
|
|
112
|
+
|
|
113
|
+
### Create theme from source
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
colamd-themes extract <source> --name "my-theme" --auto-match
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Export with theme
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
colamd-themes export-html doc.md -t elegant -o output.html
|
|
123
|
+
colamd-themes export-pdf doc.md -t my-brand -o output.pdf
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Batch export
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
colamd-themes export docs/ --format pdf -t dark -d output/
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Validate theme
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
colamd-themes validate themes/my-theme.css
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Rendering Pipeline
|
|
139
|
+
|
|
140
|
+
Export uses Puppeteer (headless Chromium) with `@bytechain.cn/colamd/renderer`:
|
|
141
|
+
|
|
142
|
+
1. Local HTTP server serves renderer ESM bundle (avoids CORS)
|
|
143
|
+
2. Puppeteer navigates to server page (same-origin)
|
|
144
|
+
3. `createColaMDEditor({ editable: false })` initializes Milkdown editor
|
|
145
|
+
4. `applyTheme(name, customCSS?)` sets theme
|
|
146
|
+
5. `setMarkdown(content)` loads document
|
|
147
|
+
6. `ensureAllPluginsRendered()` waits for mermaid/KaTeX
|
|
148
|
+
7. `buildExportHTML()` → standalone HTML with embedded CSS
|
|
149
|
+
8. For PDF: `emulateMediaType('screen')` + `page.pdf()`
|
|
150
|
+
|
|
151
|
+
## v3.0 Paradigm Constraints
|
|
152
|
+
|
|
153
|
+
- No bare hex colors in selectors — use `var(--seed-*)`
|
|
154
|
+
- No bare font sizes — use `var(--font-*)`
|
|
155
|
+
- No Mermaid SVG selectors (handled by built-in `variables.css`)
|
|
156
|
+
- `!important` only in `@media print`
|
|
157
|
+
- Generated CSS ≤ 300 lines
|
|
158
|
+
- Font stacks must include CJK fallback and end with generic family
|
|
159
|
+
|
|
160
|
+
## Architecture
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
Source → Extractor → ThemeStyle → Color System + Mermaid Preset + Validators → CSS
|
|
164
|
+
|
|
165
|
+
Markdown → Puppeteer + ColaMD Renderer → HTML / PDF
|
|
166
|
+
```
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: colamd-themes
|
|
3
|
+
version: "1.0.0"
|
|
4
|
+
description: >
|
|
5
|
+
Generate, validate, export, and manage ColaMD v3.0 paradigm CSS themes.
|
|
6
|
+
Extract from URLs/DOCX/PDF; export Markdown to HTML/PDF; batch export.
|
|
7
|
+
user-invocable: true
|
|
8
|
+
allowed-tools:
|
|
9
|
+
- Read
|
|
10
|
+
- Write
|
|
11
|
+
- Edit
|
|
12
|
+
- Bash
|
|
13
|
+
- Glob
|
|
14
|
+
- Grep
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
|
|
21
|
+
- Node.js ≥ 18
|
|
22
|
+
- Project root: run `npm install && npm run build` before first use
|
|
23
|
+
- Or run directly: `npx tsx src/cli.ts <command>`
|
|
24
|
+
|
|
25
|
+
## Commands
|
|
26
|
+
|
|
27
|
+
### Theme extraction
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
colamd-themes from-url <URL> [options]
|
|
31
|
+
colamd-themes from-docx <file> [options]
|
|
32
|
+
colamd-themes from-pdf <file> [options]
|
|
33
|
+
colamd-themes extract <source> [options]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Export to HTML / PDF
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
colamd-themes export-html <input.md> -t <theme> -o <output.html>
|
|
40
|
+
colamd-themes export-pdf <input.md> -t <theme> -o <output.pdf>
|
|
41
|
+
colamd-themes export <inputs...> --format html|pdf -t <theme> -d <dir>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Theme management
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
colamd-themes set-theme <name> --default
|
|
48
|
+
colamd-themes set-theme <name> --css <file>
|
|
49
|
+
colamd-themes set-theme <name> --css <file> --default
|
|
50
|
+
colamd-themes set-theme <name> --remove
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Inspection
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
colamd-themes color-systems [-j]
|
|
57
|
+
colamd-themes mermaid-presets [-j]
|
|
58
|
+
colamd-themes list [-d <dir>]
|
|
59
|
+
colamd-themes validate <file.css>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Options
|
|
63
|
+
|
|
64
|
+
### Extract options
|
|
65
|
+
|
|
66
|
+
| Flag | Description |
|
|
67
|
+
|------|-------------|
|
|
68
|
+
| `-n, --name` | Theme name |
|
|
69
|
+
| `-o, --output` | Output CSS file path |
|
|
70
|
+
| `-d, --themes-dir` | Themes directory (default: `themes/`) |
|
|
71
|
+
| `-c, --color-system` | Force a color system |
|
|
72
|
+
| `-m, --mermaid-preset` | Force a Mermaid preset (light/dark/elegant) |
|
|
73
|
+
| `-A, --auto-match` | Auto-match color system and Mermaid preset |
|
|
74
|
+
|
|
75
|
+
### Export options
|
|
76
|
+
|
|
77
|
+
| Flag | Description |
|
|
78
|
+
|------|-------------|
|
|
79
|
+
| `-t, --theme` | Theme: built-in name, custom name, or `.css` file path |
|
|
80
|
+
| `-o, --output` | Output file path |
|
|
81
|
+
| `-d, --output-dir` | Output directory for batch export |
|
|
82
|
+
| `--format` | Batch: `html` or `pdf`; PDF: `A4`, `Letter`, `A3` |
|
|
83
|
+
|
|
84
|
+
## Theme Resolution
|
|
85
|
+
|
|
86
|
+
`-t, --theme` accepts:
|
|
87
|
+
1. **Built-in**: `light`, `dark`, `elegant`, `newsprint`
|
|
88
|
+
2. **Custom registered**: name set via `set-theme --css`
|
|
89
|
+
3. **File path**: any `.css` file on disk
|
|
90
|
+
|
|
91
|
+
Config: `~/.colamd-themes/config.json`
|
|
92
|
+
|
|
93
|
+
## Color Systems (15 schemes)
|
|
94
|
+
|
|
95
|
+
| Family | Schemes |
|
|
96
|
+
|--------|---------|
|
|
97
|
+
| 莫兰迪 (Morandi) | misty-rose, sage-green, dusky-blue |
|
|
98
|
+
| 马卡龙 (Macaron) | strawberry, mint, lavender |
|
|
99
|
+
| 北欧 (Nordic) | fjord-blue, pine-green, cloud-grey |
|
|
100
|
+
| 复古 (Vintage) | amber, burgundy, forest |
|
|
101
|
+
| 薄荷绿 (Mint) | matcha, spearmint, seafoam |
|
|
102
|
+
|
|
103
|
+
## Mermaid Presets
|
|
104
|
+
|
|
105
|
+
`light` — cool accent on light bg | `dark` — dark bg | `elegant` — warm accent on light bg
|
|
106
|
+
|
|
107
|
+
## Workflow Examples
|
|
108
|
+
|
|
109
|
+
### Create theme from source
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
colamd-themes extract <source> --name "my-theme" --auto-match
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Export with theme
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
colamd-themes export-html doc.md -t elegant -o output.html
|
|
119
|
+
colamd-themes export-pdf doc.md -t my-brand -o output.pdf
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Batch export
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
colamd-themes export docs/ --format pdf -t dark -d output/
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Validate theme
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
colamd-themes validate themes/my-theme.css
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Rendering Pipeline
|
|
135
|
+
|
|
136
|
+
Export uses Puppeteer (headless Chromium) with `@bytechain.cn/colamd/renderer`:
|
|
137
|
+
|
|
138
|
+
1. Local HTTP server serves renderer ESM bundle (avoids CORS)
|
|
139
|
+
2. Puppeteer navigates to server page (same-origin)
|
|
140
|
+
3. `createColaMDEditor({ editable: false })` initializes Milkdown editor
|
|
141
|
+
4. `applyTheme(name, customCSS?)` sets theme
|
|
142
|
+
5. `setMarkdown(content)` loads document
|
|
143
|
+
6. `ensureAllPluginsRendered()` waits for mermaid/KaTeX
|
|
144
|
+
7. `buildExportHTML()` → standalone HTML with embedded CSS
|
|
145
|
+
8. For PDF: `emulateMediaType('screen')` + `page.pdf()`
|
|
146
|
+
|
|
147
|
+
## v3.0 Paradigm Constraints
|
|
148
|
+
|
|
149
|
+
- No bare hex colors in selectors — use `var(--seed-*)`
|
|
150
|
+
- No bare font sizes — use `var(--font-*)`
|
|
151
|
+
- No Mermaid SVG selectors (handled by built-in `variables.css`)
|
|
152
|
+
- `!important` only in `@media print`
|
|
153
|
+
- Generated CSS ≤ 300 lines
|
|
154
|
+
- Font stacks must include CJK fallback and end with generic family
|
|
155
|
+
|
|
156
|
+
## Architecture
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
Source → Extractor → ThemeStyle → Color System + Mermaid Preset + Validators → CSS
|
|
160
|
+
|
|
161
|
+
Markdown → Puppeteer + ColaMD Renderer → HTML / PDF
|
|
162
|
+
```
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# ColaMD Themes Skill Instructions
|
|
2
|
+
|
|
3
|
+
When the user asks to create, validate, export, or manage ColaMD themes, use the following CLI tool:
|
|
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
|
+
|
|
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
|
+
```
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- New theme: **Trae Blue** — modern blue-themed design for technical documentation
|
|
12
|
+
- New theme: **Forest Ink** — nature-inspired dark green palette with ink aesthetics
|
|
13
|
+
- Support for absolute path input in CLI commands
|
|
14
|
+
- Two new theme preview HTML files (colly-preview, salvator-blog-preview)
|
|
15
|
+
- CSS pitfall reference documentation
|
|
16
|
+
- Short CLI alias `cthemes` as alternative to `colamd-themes`
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
- Package name migrated to scoped format: `@bytechain.cn/colamd-themes`
|
|
20
|
+
- Optimized **Swiss Design** theme with improved typography and spacing
|
|
21
|
+
- Fixed build script template file copy logic (`package.json` build command)
|
|
22
|
+
|
|
23
|
+
### Removed
|
|
24
|
+
- `.DS_Store` files from project directory
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## [0.3.0] - 2026-06-01
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
- **Trae Blue Theme**: Modern blue color scheme optimized for developer documentation and technical writing
|
|
32
|
+
- **Forest Ink Theme**: Dark forest-inspired theme with elegant ink-style aesthetics
|
|
33
|
+
- **Absolute Path Support**: CLI now accepts absolute file paths for all input commands
|
|
34
|
+
- **Theme Previews**: Added interactive HTML previews for colly and salvator-blog themes
|
|
35
|
+
- **CSS Reference**: Included common CSS pitfalls and best practices documentation
|
|
36
|
+
- **Short CLI Alias**: `cthemes` command added as shorthand for `colamd-themes`
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
- **Package Name**: Migrated from `colamd-themes` to `@bytechain.cn/colamd-themes` (scoped package)
|
|
40
|
+
- **Swiss Design Enhancement**: Refined Swiss Design theme with better contrast ratios and improved readability
|
|
41
|
+
- **Build Process Fix**: Corrected template file copying logic in build script to ensure proper distribution
|
|
42
|
+
|
|
43
|
+
### Removed
|
|
44
|
+
- System files (`.DS_Store`) cleaned from repository
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## [0.2.0] - 2026-05-25
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
- **v3.0 Seed Palette Paradigm**: Complete implementation of ColaMD's new design token system
|
|
52
|
+
- 15 predefined seed palettes across 5 families (Morandi, Macaron, Nordic, Vintage, Mint)
|
|
53
|
+
- Auto-derived semantic mapping from seed tokens via CSS custom properties
|
|
54
|
+
- Mermaid diagram presets (light/dark/elegant) with 20 core variables
|
|
55
|
+
- **Academic Style Theme**: Specialized theme for academic paper formatting
|
|
56
|
+
- **Three Base Themes**: Initial set of core themes (elegant, newsprint, light/dark)
|
|
57
|
+
- **Theme Validation Engine**: WCAG 2.1 compliance checking with 15+ design constraint rules
|
|
58
|
+
- **Color System Library**: Comprehensive color palette management utilities
|
|
59
|
+
|
|
60
|
+
### Changed
|
|
61
|
+
- **Extractor Refactoring**: Complete rewrite of URL, DOCX, and PDF extractors
|
|
62
|
+
- Improved CSS rule parsing via `css-tree`
|
|
63
|
+
- Enhanced specificity calculation for inline style resolution
|
|
64
|
+
- Multi-layer heuristic analysis for PDF metadata extraction
|
|
65
|
+
- **Academic Paper Theme**: Restructured to follow v3.0 paradigm specifications
|
|
66
|
+
- **Template Engine**: Handlebars-powered CSS generation with 6-section output structure
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
- Merge conflict resolution for `academic-paper.css` (adopted remote version)
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## [0.1.0] - 2026-05-22
|
|
74
|
+
|
|
75
|
+
### Added
|
|
76
|
+
- **Initial Release**: Core ColaMD theme development toolkit
|
|
77
|
+
- **CLI Interface**: Command-line tool for theme management and export operations
|
|
78
|
+
- **Theme Extraction**:
|
|
79
|
+
- URL-based extractor with CSS parsing
|
|
80
|
+
- DOCX extractor using mammoth for Word document styles
|
|
81
|
+
- PDF extractor with typography metadata analysis
|
|
82
|
+
- Auto-detection of source type
|
|
83
|
+
- **Export Functionality**:
|
|
84
|
+
- Markdown to HTML export with embedded theme CSS
|
|
85
|
+
- Markdown to PDF export via Puppeteer rendering
|
|
86
|
+
- Batch export support for multiple files/directories
|
|
87
|
+
- **Theme Management**:
|
|
88
|
+
- Built-in theme registration system
|
|
89
|
+
- Custom theme import from CSS files
|
|
90
|
+
- Default theme configuration
|
|
91
|
+
- **Core Utilities**:
|
|
92
|
+
- Color system with contrast ratio calculations
|
|
93
|
+
- Typography management
|
|
94
|
+
- Mermaid diagram integration
|
|
95
|
+
- KaTeX math rendering support
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
[Unreleased]: https://github.com/byteuser1977/ColaMD-themes/compare/v0.3.0...HEAD
|
|
100
|
+
[0.3.0]: https://github.com/byteuser1977/ColaMD-themes/compare/v0.2.0...v0.3.0
|
|
101
|
+
[0.2.0]: https://github.com/byteuser1977/ColaMD-themes/compare/v0.1.0...v0.2.0
|
|
102
|
+
[0.1.0]: https://github.com/byteuser1977/ColaMD-themes/releases/tag/v0.1.0
|