vscode-colaview 0.0.0-stage → 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.
Files changed (46) hide show
  1. package/.vscode/launch.json +30 -0
  2. package/.vscode/settings.json +7 -0
  3. package/.vscode/tasks.json +18 -0
  4. package/.vscodeignore +23 -0
  5. package/CHANGELOG.md +112 -0
  6. package/LICENSE +21 -0
  7. package/README.md +264 -2
  8. package/README_CN.md +265 -0
  9. package/RELEASE_NOTES.md +201 -0
  10. package/esbuild.js +106 -0
  11. package/icon.png +0 -0
  12. package/package.json +186 -6
  13. package/src/commands/commands.ts +105 -0
  14. package/src/export/css-collector.ts +50 -0
  15. package/src/export/docx-exporter.ts +923 -0
  16. package/src/export/html-exporter.ts +18 -0
  17. package/src/export/pdf-exporter.ts +121 -0
  18. package/src/export/render-export-images.ts +206 -0
  19. package/src/export/theme-style.ts +135 -0
  20. package/src/extension.ts +59 -0
  21. package/src/preview/preview-manager.ts +499 -0
  22. package/src/preview/webview/app.ts +371 -0
  23. package/src/preview/webview/index.html +127 -0
  24. package/src/themes/built-in/bear.css +38 -0
  25. package/src/themes/built-in/dark.css +20 -0
  26. package/src/themes/built-in/dracula.css +38 -0
  27. package/src/themes/built-in/elegant.css +52 -0
  28. package/src/themes/built-in/gruvbox.css +42 -0
  29. package/src/themes/built-in/light.css +20 -0
  30. package/src/themes/built-in/midnight.css +31 -0
  31. package/src/themes/built-in/nord.css +38 -0
  32. package/src/themes/built-in/notion.css +48 -0
  33. package/src/themes/built-in/sepia.css +47 -0
  34. package/src/themes/built-in/solarized-dark.css +35 -0
  35. package/src/themes/built-in/writer.css +44 -0
  36. package/src/themes/theme-manager.ts +180 -0
  37. package/src/types/colamd-renderer.d.ts +47 -0
  38. package/src/types.ts +20 -0
  39. package/test/fixtures/basic.md +34 -0
  40. package/test/fixtures/math.md +20 -0
  41. package/test/fixtures/mermaid.md +19 -0
  42. package/test/runTest.ts +30 -0
  43. package/test/suite/html-exporter.test.ts +20 -0
  44. package/test/suite/markdown-parser.test.ts +8 -0
  45. package/test/suite/theme-manager.test.ts +31 -0
  46. package/tsconfig.json +19 -0
@@ -0,0 +1,371 @@
1
+ /// <reference lib="dom" />
2
+ /**
3
+ * ColaView MD — WebView runtime
4
+ * CodeMirror 6 based ColaMD editor in read-only mode + right-click context menu.
5
+ * @bytechain.cn/colamd@2.7.9 适配
6
+ */
7
+ import { createColaMDEditor, type ColaMDRendererHandle } from '@bytechain.cn/colamd/renderer';
8
+
9
+ // @ts-ignore — VSCode WebView API
10
+ const vscode = acquireVsCodeApi();
11
+
12
+ let handle: ColaMDRendererHandle | null = null;
13
+ let currentMarkdown = '';
14
+ let currentTheme = 'elegant';
15
+ let themeListData: { builtins: string[]; customs: string[]; current: string } | null = null;
16
+ let scrollDebounceTimer: number | null = null;
17
+ let receivedScrollFromEditor = false;
18
+
19
+ function getScrollContainer(): HTMLElement | null {
20
+ // CodeMirror 6 把滚动放在 .cm-scroller 上,#editor 本身不动
21
+ return document.querySelector<HTMLElement>('.cm-scroller');
22
+ }
23
+
24
+ function setupScrollSync(): void {
25
+ const scroller = getScrollContainer();
26
+ if (!scroller) return;
27
+
28
+ scroller.addEventListener('scroll', (e) => {
29
+ const target = e.target as HTMLElement;
30
+ if (scrollDebounceTimer) clearTimeout(scrollDebounceTimer);
31
+
32
+ scrollDebounceTimer = window.setTimeout(() => {
33
+ if (receivedScrollFromEditor) {
34
+ receivedScrollFromEditor = false;
35
+ return;
36
+ }
37
+
38
+ const scrollPercent = target.scrollTop / (target.scrollHeight - target.clientHeight);
39
+ vscode.postMessage({
40
+ type: 'scrollSync',
41
+ scrollPercent: Math.max(0, Math.min(1, scrollPercent)),
42
+ });
43
+ }, 50);
44
+ });
45
+ }
46
+
47
+ function scrollToPercent(percent: number): void {
48
+ const scroller = getScrollContainer();
49
+ if (!scroller || !handle) return;
50
+
51
+ receivedScrollFromEditor = true;
52
+
53
+ const maxScroll = scroller.scrollHeight - scroller.clientHeight;
54
+ const targetScrollTop = Math.max(0, Math.min(percent * maxScroll, maxScroll));
55
+
56
+ scroller.scrollTo({
57
+ top: targetScrollTop,
58
+ behavior: 'smooth'
59
+ });
60
+ }
61
+
62
+ function scrollToLine(line: number, totalLines: number, topRatio: number = 0.3): void {
63
+ const scroller = getScrollContainer();
64
+ if (!scroller || !handle) return;
65
+
66
+ receivedScrollFromEditor = true;
67
+
68
+ const contentEl = document.querySelector<HTMLElement>('#editor .cm-content');
69
+ if (!contentEl) {
70
+ const scrollPercent = totalLines > 1 ? line / (totalLines - 1) : 0;
71
+ scrollToPercent(scrollPercent);
72
+ return;
73
+ }
74
+
75
+ // CM6 只渲染视口内的内容,所以只能用比例估算
76
+ const scrollPercent = totalLines > 1 ? line / (totalLines - 1) : 0;
77
+ const maxScroll = scroller.scrollHeight - scroller.clientHeight;
78
+ const targetScrollTop = Math.max(0, Math.min(scrollPercent * maxScroll, maxScroll));
79
+
80
+ scroller.scrollTo({
81
+ top: targetScrollTop,
82
+ behavior: 'smooth'
83
+ });
84
+ }
85
+
86
+ function injectThemeCSS(css: string | undefined): void {
87
+ if (!css) return;
88
+ let el = document.getElementById('colaview-theme-css');
89
+ if (!el) {
90
+ el = document.createElement('style');
91
+ el.id = 'colaview-theme-css';
92
+ document.head.appendChild(el);
93
+ }
94
+ el.textContent = css;
95
+ }
96
+
97
+ /**
98
+ * 确保 body 挂上主题类。colamd 的 buildExportHTML 会把 document.body 的 class
99
+ * 原样复制到导出 HTML 的 <body>,而它收集的主题规则全部以 body.theme-X 为作用域
100
+ * (字体、强调色、主题变量)。预览本身靠注入的 :root 变量 + #editor 规则就能生效,
101
+ * 不依赖 body 类 —— 但导出不补上这个类就会整体丢格式。
102
+ */
103
+ function ensureBodyThemeClass(): void {
104
+ const builtins = themeListData?.builtins ?? [];
105
+ if (builtins.length > 0 && !builtins.includes(currentTheme)) {
106
+ document.body.classList.add('theme-custom');
107
+ return;
108
+ }
109
+ // 内置主题:与 colamd 内部映射一致(theme-<name>)
110
+ document.body.classList.add(`theme-${currentTheme}`);
111
+ }
112
+
113
+ window.addEventListener('message', async (event: MessageEvent) => {
114
+ const data = event.data;
115
+ switch (data.type) {
116
+ case 'init': {
117
+ try {
118
+ currentTheme = data.theme || 'elegant';
119
+ injectThemeCSS(data.themeCSS);
120
+
121
+ // 2.7.9 API: 先创建编辑器(options 中不含 theme)
122
+ handle = await createColaMDEditor({
123
+ rootId: 'editor',
124
+ editable: false,
125
+ });
126
+
127
+ // 然后应用主题
128
+ if (data.customCSS && data.theme) {
129
+ handle.applyTheme('custom:' + data.theme, data.customCSS);
130
+ } else {
131
+ handle.applyTheme(currentTheme);
132
+ }
133
+ ensureBodyThemeClass();
134
+
135
+ // 最后设置 markdown
136
+ if (data.markdown) {
137
+ handle.setMarkdown(data.markdown);
138
+ currentMarkdown = data.markdown;
139
+ }
140
+
141
+ setupScrollSync();
142
+ } catch (e) {
143
+ console.error('[ColaView] init failed:', e);
144
+ vscode.postMessage({ type: 'error', message: String(e) });
145
+ }
146
+ break;
147
+ }
148
+ case 'update': {
149
+ if (!handle) return;
150
+ if (data.markdown !== undefined && data.markdown !== currentMarkdown) {
151
+ handle.setMarkdown(data.markdown);
152
+ currentMarkdown = data.markdown;
153
+ }
154
+ if (data.theme) {
155
+ injectThemeCSS(data.themeCSS);
156
+ if (data.customCSS) {
157
+ handle.applyTheme('custom:' + data.theme, data.customCSS);
158
+ } else {
159
+ handle.applyTheme(data.theme);
160
+ }
161
+ currentTheme = data.theme;
162
+ ensureBodyThemeClass();
163
+ }
164
+ break;
165
+ }
166
+ case 'exportHTML': {
167
+ if (!handle) {
168
+ vscode.postMessage({ type: 'exportHTMLResult', html: '' });
169
+ return;
170
+ }
171
+ try {
172
+ ensureBodyThemeClass();
173
+ const html = await handle.buildExportHTML({
174
+ title: data.title || document.title || 'Document',
175
+ });
176
+ vscode.postMessage({ type: 'exportHTMLResult', html });
177
+ } catch (e) {
178
+ console.error('[ColaView] exportHTML failed:', e);
179
+ vscode.postMessage({ type: 'exportHTMLResult', html: '', error: String(e) });
180
+ }
181
+ break;
182
+ }
183
+ case 'updateTheme': {
184
+ if (!handle || !data.theme) return;
185
+ injectThemeCSS(data.themeCSS);
186
+ if (data.customCSS) {
187
+ handle.applyTheme('custom:' + data.theme, data.customCSS);
188
+ } else {
189
+ handle.applyTheme(data.theme);
190
+ }
191
+ currentTheme = data.theme;
192
+ ensureBodyThemeClass();
193
+ break;
194
+ }
195
+ case 'applyCustomTheme': {
196
+ if (!data.css || !handle) return;
197
+ const themeName = data.name || currentTheme;
198
+ handle.applyTheme('custom:' + themeName, data.css);
199
+ break;
200
+ }
201
+ case 'togglePlugin': {
202
+ // 2.7.9 不再支持 togglePlugin — math 和 mermaid 是内置的
203
+ // 此消息保留但不再执行操作,避免旧配置项报错
204
+ break;
205
+ }
206
+ case 'themeList': {
207
+ themeListData = {
208
+ builtins: data.builtins || [],
209
+ customs: data.customs || [],
210
+ current: data.current || currentTheme,
211
+ };
212
+ refreshThemeSubmenu();
213
+ break;
214
+ }
215
+ case 'editorScroll': {
216
+ if (data.scrollPercent !== undefined) {
217
+ scrollToPercent(data.scrollPercent);
218
+ } else if (data.line !== undefined) {
219
+ scrollToLine(data.line, data.totalLines || 100, data.topRatio || 0.3);
220
+ }
221
+ break;
222
+ }
223
+ }
224
+ });
225
+
226
+ // ── Context Menu ──────────────────────────────────────────────
227
+ let menuEl: HTMLElement | null = null;
228
+ let themeSubmenuEl: HTMLElement | null = null;
229
+
230
+ function closeMenu(): void {
231
+ if (menuEl) {
232
+ menuEl.remove();
233
+ menuEl = null;
234
+ themeSubmenuEl = null;
235
+ }
236
+ document.removeEventListener('click', closeMenu);
237
+ document.removeEventListener('contextmenu', closeMenu);
238
+ }
239
+
240
+ function createMenuItem(label: string, onClick: () => void): HTMLElement {
241
+ const item = document.createElement('div');
242
+ item.className = 'ctx-menu-item';
243
+ item.textContent = label;
244
+ item.addEventListener('click', (e) => {
245
+ e.stopPropagation();
246
+ closeMenu();
247
+ onClick();
248
+ });
249
+ return item;
250
+ }
251
+
252
+ function createMenuSeparator(): HTMLElement {
253
+ const sep = document.createElement('div');
254
+ sep.className = 'ctx-menu-separator';
255
+ return sep;
256
+ }
257
+
258
+ function buildThemeSubmenu(): HTMLElement {
259
+ const submenu = document.createElement('div');
260
+ submenu.className = 'ctx-menu-submenu';
261
+ themeSubmenuEl = submenu;
262
+
263
+ if (!themeListData) {
264
+ vscode.postMessage({ type: 'requestThemeList' });
265
+ const loading = document.createElement('div');
266
+ loading.className = 'ctx-menu-item ctx-menu-disabled';
267
+ loading.textContent = 'Loading...';
268
+ submenu.appendChild(loading);
269
+ return submenu;
270
+ }
271
+
272
+ for (const name of themeListData.builtins) {
273
+ const item = document.createElement('div');
274
+ item.className = 'ctx-menu-item' + (name === themeListData.current ? ' ctx-menu-active' : '');
275
+ item.textContent = name.charAt(0).toUpperCase() + name.slice(1).replace(/-/g, ' ');
276
+ item.addEventListener('click', (e) => {
277
+ e.stopPropagation();
278
+ if (themeListData) themeListData.current = name;
279
+ closeMenu();
280
+ vscode.postMessage({ type: 'switchTheme', name });
281
+ });
282
+ submenu.appendChild(item);
283
+ }
284
+
285
+ if (themeListData.customs.length > 0) {
286
+ const sep = document.createElement('div');
287
+ sep.className = 'ctx-menu-separator';
288
+ submenu.appendChild(sep);
289
+
290
+ for (const name of themeListData.customs) {
291
+ const item = document.createElement('div');
292
+ item.className = 'ctx-menu-item' + (name === themeListData.current ? ' ctx-menu-active' : '');
293
+ item.textContent = name;
294
+ item.addEventListener('click', (e) => {
295
+ e.stopPropagation();
296
+ if (themeListData) themeListData.current = name;
297
+ closeMenu();
298
+ vscode.postMessage({ type: 'switchTheme', name });
299
+ });
300
+ submenu.appendChild(item);
301
+ }
302
+ }
303
+
304
+ return submenu;
305
+ }
306
+
307
+ function refreshThemeSubmenu(): void {
308
+ if (!menuEl || !themeSubmenuEl) return;
309
+ const parent = themeSubmenuEl.parentElement;
310
+ if (!parent) return;
311
+ const newSubmenu = buildThemeSubmenu();
312
+ parent.replaceChild(newSubmenu, themeSubmenuEl);
313
+ }
314
+
315
+ function showMenu(x: number, y: number): void {
316
+ closeMenu();
317
+
318
+ const menu = document.createElement('div');
319
+ menu.className = 'ctx-menu';
320
+ menu.style.left = x + 'px';
321
+ menu.style.top = y + 'px';
322
+ menuEl = menu;
323
+
324
+ menu.appendChild(createMenuItem('Export HTML', () => {
325
+ vscode.postMessage({ type: 'requestExportHTML' });
326
+ }));
327
+
328
+ menu.appendChild(createMenuItem('Export PDF', () => {
329
+ vscode.postMessage({ type: 'requestExportPDF' });
330
+ }));
331
+
332
+ menu.appendChild(createMenuItem('Export Word', () => {
333
+ vscode.postMessage({ type: 'requestExportWord' });
334
+ }));
335
+
336
+ menu.appendChild(createMenuSeparator());
337
+
338
+ const themeItem = document.createElement('div');
339
+ themeItem.className = 'ctx-menu-item ctx-menu-has-submenu';
340
+ themeItem.textContent = 'Theme';
341
+ themeItem.appendChild(buildThemeSubmenu());
342
+ menu.appendChild(themeItem);
343
+
344
+ menu.appendChild(createMenuSeparator());
345
+
346
+ menu.appendChild(createMenuItem('Import Theme...', () => {
347
+ vscode.postMessage({ type: 'requestImportTheme' });
348
+ }));
349
+
350
+ document.body.appendChild(menu);
351
+
352
+ const rect = menu.getBoundingClientRect();
353
+ if (rect.right > window.innerWidth) {
354
+ menu.style.left = (x - rect.width) + 'px';
355
+ }
356
+ if (rect.bottom > window.innerHeight) {
357
+ menu.style.top = (y - rect.height) + 'px';
358
+ }
359
+
360
+ setTimeout(() => {
361
+ document.addEventListener('click', closeMenu);
362
+ document.addEventListener('contextmenu', closeMenu);
363
+ }, 0);
364
+ }
365
+
366
+ document.addEventListener('contextmenu', (e) => {
367
+ e.preventDefault();
368
+ showMenu(e.clientX, e.clientY);
369
+ });
370
+
371
+ vscode.postMessage({ type: 'ready' });
@@ -0,0 +1,127 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline' vscode-webview-resource:; script-src 'unsafe-inline' vscode-webview-resource:; font-src vscode-webview-resource: data:; img-src file: data: vscode-webview-resource: https:; connect-src https: vscode-webview-resource:;">
7
+ <link rel="stylesheet" href="colamd.css" id="colamd-css">
8
+ <!-- 变量名对齐 ColaMD 2.7.9 主题契约: --bg-color / --text-color / --border-color 等 -->
9
+ <style>
10
+ html, body {
11
+ height: 100%;
12
+ margin: 0;
13
+ padding: 0;
14
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
15
+ background: var(--bg-color, #fff) !important;
16
+ color: var(--text-color, #24292f) !important;
17
+ }
18
+ /* CodeMirror 6 编辑器容器 */
19
+ #editor {
20
+ min-height: 100vh;
21
+ }
22
+ /* CodeMirror 焦点轮廓去除 */
23
+ #editor.cm-editor.cm-focused {
24
+ outline: none;
25
+ }
26
+ #editor .cm-content {
27
+ padding: 20px 40px 40px;
28
+ max-width: 780px;
29
+ margin: 0 auto;
30
+ min-height: calc(100vh - 60px);
31
+ cursor: default;
32
+ }
33
+ #editor .cm-editor.cm-focused > .cm-scroller > .cm-content,
34
+ #editor .cm-editor.cm-focused > .cm-scroller > .cm-gutters {
35
+ cursor: default;
36
+ }
37
+ /* 隐藏光标和选区高亮(只读预览) */
38
+ #editor .cm-cursor,
39
+ #editor .cm-selectionBackground,
40
+ #editor.cm-focused .cm-selectionBackground,
41
+ #editor .cm-content ::selection {
42
+ opacity: 0 !important;
43
+ }
44
+ /* CodeMirror 6 默认不换行,Markdown 预览必须换行 */
45
+ #editor .cm-content {
46
+ white-space: pre-wrap;
47
+ word-wrap: break-word;
48
+ }
49
+ /* 滚动容器 */
50
+ #editor .cm-scroller {
51
+ overflow: auto;
52
+ }
53
+
54
+ /* ── Context Menu ── */
55
+ .ctx-menu {
56
+ position: fixed;
57
+ z-index: 9999;
58
+ min-width: 180px;
59
+ background: var(--bg-color, #fff);
60
+ color: var(--text-color, #24292f);
61
+ border: 1px solid var(--border-color, #d0d7de);
62
+ border-radius: 8px;
63
+ box-shadow: 0 4px 16px rgba(0,0,0,0.12);
64
+ padding: 4px 0;
65
+ font-size: 13px;
66
+ line-height: 1.5;
67
+ user-select: none;
68
+ }
69
+ .ctx-menu-item {
70
+ position: relative;
71
+ padding: 6px 16px;
72
+ cursor: pointer;
73
+ white-space: nowrap;
74
+ }
75
+ .ctx-menu-item:hover {
76
+ background: var(--code-bg, rgba(0,0,0,0.06));
77
+ color: var(--link-color, #0969da);
78
+ }
79
+ .ctx-menu-disabled {
80
+ color: var(--text-muted, #8b949e);
81
+ pointer-events: none;
82
+ }
83
+ .ctx-menu-active {
84
+ font-weight: 600;
85
+ }
86
+ .ctx-menu-active::before {
87
+ content: '✓';
88
+ position: absolute;
89
+ left: 4px;
90
+ }
91
+ .ctx-menu-separator {
92
+ height: 1px;
93
+ margin: 4px 0;
94
+ background: var(--border-color, #d0d7de);
95
+ }
96
+ .ctx-menu-has-submenu {
97
+ padding-right: 28px;
98
+ }
99
+ .ctx-menu-has-submenu::after {
100
+ content: '▸';
101
+ position: absolute;
102
+ right: 10px;
103
+ color: var(--text-muted, #8b949e);
104
+ }
105
+ .ctx-menu-submenu {
106
+ position: absolute;
107
+ top: -4px;
108
+ left: 100%;
109
+ min-width: 160px;
110
+ background: var(--bg-color, #fff);
111
+ color: var(--text-color, #24292f);
112
+ border: 1px solid var(--border-color, #d0d7de);
113
+ border-radius: 8px;
114
+ box-shadow: 0 4px 16px rgba(0,0,0,0.12);
115
+ padding: 4px 0;
116
+ display: none;
117
+ }
118
+ .ctx-menu-has-submenu:hover > .ctx-menu-submenu {
119
+ display: block;
120
+ }
121
+ </style>
122
+ </head>
123
+ <body>
124
+ <div id="editor"></div>
125
+ <script src="app.js"></script>
126
+ </body>
127
+ </html>
@@ -0,0 +1,38 @@
1
+ /* ===== ColaMD Theme: 熊红 Bear =====
2
+ Crisp white with confident red accent, Bear style.
3
+
4
+ Import: Theme > Import Theme, or place in ~/.colamd/themes/
5
+ Variables target :root; element rules target the ColaMD editor DOM. */
6
+
7
+ :root {
8
+ --bg-color: #ffffff;
9
+ --text-color: #262626;
10
+ --text-secondary: #767676;
11
+ --text-muted: #8a8a8a;
12
+ --border-color: #e8e6e3;
13
+ --link-color: #d43d2a;
14
+ --code-bg: rgba(212, 61, 42, 0.07);
15
+ --code-block-bg: #2e2a28;
16
+ --code-block-text: #efe9e4;
17
+ --blockquote-border: #d43d2a;
18
+ --table-header-bg: #f7f5f3;
19
+ --selection-bg: rgba(212, 61, 42, 0.12);
20
+ --highlight-bg: #ffe9a8;
21
+ }
22
+
23
+ #editor .cm-content .cm-md-strong {
24
+ color: #d43d2a;
25
+ }
26
+
27
+ #editor .cm-content .cm-md-inlinecode {
28
+ color: #d43d2a;
29
+ }
30
+
31
+ #editor .cm-content .cm-md-atxheading1 {
32
+ letter-spacing: -0.01em;
33
+ }
34
+
35
+ #editor .cm-content .cm-md-hr {
36
+ border-top-color: #d43d2a;
37
+ opacity: 0.35;
38
+ }
@@ -0,0 +1,20 @@
1
+ /* ===== ColaMD Theme: 深色 Dark =====
2
+ GitHub dark: soft black with blue links.
3
+
4
+ Import: Theme > Import Theme, or place in ~/.colamd/themes/
5
+ Variables target :root; element rules target the ColaMD editor DOM. */
6
+
7
+ :root {
8
+ --bg-color: #0d1117;
9
+ --text-color: #e6edf3;
10
+ --text-secondary: #aab3bd;
11
+ --text-muted: #8b949e;
12
+ --border-color: #30363d;
13
+ --link-color: #58a6ff;
14
+ --code-bg: rgba(110, 118, 129, 0.3);
15
+ --code-block-bg: #161b22;
16
+ --blockquote-border: #30363d;
17
+ --table-header-bg: #161b22;
18
+ --selection-bg: rgba(88, 166, 255, 0.2);
19
+ --highlight-bg: rgba(210, 153, 34, 0.35);
20
+ }
@@ -0,0 +1,38 @@
1
+ /* ===== ColaMD Theme: 德古拉 Dracula =====
2
+ Gothic neon: pink, purple, and cyan candlelight.
3
+
4
+ Import: Theme > Import Theme, or place in ~/.colamd/themes/
5
+ Variables target :root; element rules target the ColaMD editor DOM. */
6
+
7
+ :root {
8
+ --bg-color: #282a36;
9
+ --text-color: #f8f8f2;
10
+ --text-secondary: #afb7db;
11
+ --text-muted: #7f86a8;
12
+ --border-color: #44475a;
13
+ --link-color: #bd93f9;
14
+ --code-bg: rgba(98, 114, 164, 0.2);
15
+ --code-block-bg: #21222c;
16
+ --blockquote-border: #ff79c6;
17
+ --table-header-bg: #343746;
18
+ --selection-bg: rgba(189, 147, 249, 0.25);
19
+ --highlight-bg: rgba(241, 250, 140, 0.22);
20
+ }
21
+
22
+ #editor .cm-content .cm-md-atxheading1,
23
+ #editor .cm-content .cm-md-atxheading2,
24
+ #editor .cm-content .cm-md-atxheading3 {
25
+ color: #ffffff;
26
+ }
27
+
28
+ #editor .cm-content .cm-md-strong {
29
+ color: #ff79c6;
30
+ }
31
+
32
+ #editor .cm-content .cm-md-inlinecode {
33
+ color: #8be9fd;
34
+ }
35
+
36
+ #editor .cm-content .cm-md-blockquote {
37
+ color: #c3c8e0;
38
+ }
@@ -0,0 +1,52 @@
1
+ /* ===== ColaMD Theme: 雅致 Elegant =====
2
+ Warm serif with terracotta accents, inspired by classic writing apps.
3
+
4
+ Import: Theme > Import Theme, or place in ~/.colamd/themes/
5
+ Variables target :root; element rules target the ColaMD editor DOM. */
6
+
7
+ :root {
8
+ --bg-color: #f0edea;
9
+ --text-color: #2c2c2c;
10
+ --text-secondary: #6c6c6c;
11
+ --text-muted: #777;
12
+ --border-color: #d8d3ce;
13
+ --link-color: #bc4424;
14
+ --code-bg: #e8e4df;
15
+ --code-block-bg: #2c2c2c;
16
+ --code-block-text: #e0dcd7;
17
+ --blockquote-border: #c44b2b;
18
+ --blockquote-bg: #eae6e1;
19
+ --table-header-bg: #eae6e1;
20
+ --table-border: #d8d3ce;
21
+ --selection-bg: rgba(196, 75, 43, 0.2);
22
+ --highlight-bg: #f0d9a8;
23
+ }
24
+
25
+ #editor .cm-content {
26
+ font-family: 'LXGW WenKai', 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', Georgia, serif;
27
+ line-height: 1.9;
28
+ }
29
+
30
+ #editor .cm-content .cm-md-strong {
31
+ color: #c44b2b;
32
+ }
33
+
34
+ #editor .cm-content .cm-md-inlinecode {
35
+ color: #c44b2b;
36
+ }
37
+
38
+ #editor .cm-content .cm-md-blockquote {
39
+ /* Horizontal only: a quote is one div per line in the editor, so vertical
40
+ padding would be added once for every line of the quote. */
41
+ padding-left: 25px;
42
+ padding-right: 20px;
43
+ }
44
+
45
+ #editor .cm-content .cm-md-table-widget th {
46
+ border-bottom: 2px solid #c44b2b;
47
+ }
48
+
49
+ #editor .cm-content .cm-md-table-widget td {
50
+ border-left: none;
51
+ border-right: none;
52
+ }
@@ -0,0 +1,42 @@
1
+ /* ===== ColaMD Theme: 暖木 Gruvbox =====
2
+ Warm walnut dark, cream text, orange ember accents.
3
+
4
+ Import: Theme > Import Theme, or place in ~/.colamd/themes/
5
+ Variables target :root; element rules target the ColaMD editor DOM. */
6
+
7
+ :root {
8
+ --bg-color: #282828;
9
+ --text-color: #ebdbb2;
10
+ --text-secondary: #c5b5a5;
11
+ --text-muted: #928374;
12
+ --border-color: #3c3836;
13
+ --link-color: #83a598;
14
+ --code-bg: rgba(235, 219, 178, 0.1);
15
+ --code-block-bg: #1d2021;
16
+ --blockquote-border: #fe8019;
17
+ --table-header-bg: #3c3836;
18
+ --selection-bg: rgba(254, 128, 25, 0.2);
19
+ --highlight-bg: rgba(250, 189, 47, 0.22);
20
+ }
21
+
22
+ #editor .cm-content .cm-md-atxheading1,
23
+ #editor .cm-content .cm-md-atxheading2,
24
+ #editor .cm-content .cm-md-atxheading3 {
25
+ color: #fbf1c7;
26
+ }
27
+
28
+ #editor .cm-content .cm-md-strong {
29
+ color: #fe8019;
30
+ }
31
+
32
+ #editor .cm-content .cm-md-inlinecode {
33
+ color: #b8bb26;
34
+ }
35
+
36
+ #editor .cm-content .cm-md-blockquote {
37
+ color: #bdae93;
38
+ }
39
+
40
+ #editor .cm-content .cm-md-hr {
41
+ border-top-color: #504945;
42
+ }