@x-cmd/draw 0.4.5 → 0.4.7

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.
@@ -1,6 +1,6 @@
1
1
  import { sideSegments, sideTotals } from '../specs/butterfly.js';
2
2
  import { TAB, card } from '../theme.js';
3
- import { esc, fmtFull, niceTicks, r2, sVar, svgDoc, textW, topLegend, trunc, } from './svg.js';
3
+ import { esc, fmtFull, niceTicks, r2, roundEdgeRect, sVar, svgDoc, textW, topLegend, trunc, } from './svg.js';
4
4
  const PAD = 24;
5
5
  const LEGEND_H = 26;
6
6
  const VALUE_W = 54; // 外端数值那一列的宽
@@ -145,15 +145,19 @@ export function renderButterfly(spec, o) {
145
145
  parts.push(`<rect x="${r2(dir < 0 ? centre - half : centre)}" y="${r2(y)}" width="${r2(half)}" height="${r2(barH)}" rx="4" fill="${TRACK}" fill-opacity="0.35"/>`);
146
146
  }
147
147
  let acc = 0;
148
- for (const seg of segs) {
149
- const len = (seg.values[i] ?? 0) / sideMax * half;
150
- if (len <= 0) {
151
- continue;
152
- }
153
- const x = dir < 0 ? centre - acc - len : centre + acc;
154
- parts.push(`<rect x="${r2(x)}" y="${r2(y)}" width="${r2(len)}" height="${r2(barH)}" rx="4" fill="${seg.color}"/>`);
155
- acc += len;
156
- }
148
+ // 段:自中轴往外堆叠 —— **只有最外端那一圈是圆角** ✓(#130)
149
+ // 起点贴着中轴、堆叠的中段接缝:直角 ✓(圆了像悬空/像断开 ✗)
150
+ const posSegs = segs
151
+ .map((seg) => ({ seg, len: (seg.values[i] ?? 0) / sideMax * half }))
152
+ .filter((p) => p.len > 0);
153
+ posSegs.forEach((p, k) => {
154
+ const x = dir < 0 ? centre - acc - p.len : centre + acc;
155
+ const d = k === posSegs.length - 1
156
+ ? roundEdgeRect(x, y, p.len, barH, 4, dir < 0 ? 'left' : 'right')
157
+ : `M${r2(x)} ${r2(y)}h${r2(p.len)}v${r2(barH)}h${r2(-p.len)}Z`;
158
+ parts.push(`<path d="${d}" fill="${p.seg.color}"/>`);
159
+ acc += p.len;
160
+ });
157
161
  // 外端的数值:折线在柱之上,数值得等折线画完再画(否则被线盖住)
158
162
  const v = totals[i];
159
163
  // 零长度的柱不写数字:那一格什么都没有,写个 "0" 只会把读者的眼睛拉到空处
@@ -284,14 +288,18 @@ export function renderButterfly(spec, o) {
284
288
  parts.push(`<rect x="${r2(x)}" y="${r2(dir < 0 ? centreY - half : centreY)}" width="${r2(barW)}" height="${r2(half)}" rx="4" fill="${TRACK}" fill-opacity="0.35"/>`);
285
289
  }
286
290
  let acc = 0;
287
- for (const seg of segs) {
288
- const len = (seg.values[i] ?? 0) / sideMax * half;
289
- if (len <= 0)
290
- continue;
291
- const y = dir < 0 ? centreY - acc - len : centreY + acc;
292
- parts.push(`<rect x="${r2(x)}" y="${r2(y)}" width="${r2(barW)}" height="${r2(len)}" rx="4" fill="${seg.color}"/>`);
293
- acc += len;
294
- }
291
+ // 同上(#130):只有最外端圆角,起点与中段直角 —— 上下版是竖着长
292
+ const posSegs = segs
293
+ .map((seg) => ({ seg, len: (seg.values[i] ?? 0) / sideMax * half }))
294
+ .filter((p) => p.len > 0);
295
+ posSegs.forEach((p, k) => {
296
+ const sy = dir < 0 ? centreY - acc - p.len : centreY + acc;
297
+ const d = k === posSegs.length - 1
298
+ ? roundEdgeRect(x, sy, barW, p.len, 4, dir < 0 ? 'top' : 'bottom')
299
+ : `M${r2(x)} ${r2(sy)}h${r2(barW)}v${r2(p.len)}h${r2(-barW)}Z`;
300
+ parts.push(`<path d="${d}" fill="${p.seg.color}"/>`);
301
+ acc += p.len;
302
+ });
295
303
  const v = totals[i];
296
304
  // 零长度的柱不写数字(同上)
297
305
  if (!(v > 0))
@@ -1,6 +1,6 @@
1
1
  import { matchLadderRows } from '../specs/ladder.js';
2
2
  import { TAB, card } from '../theme.js';
3
- import { esc, fmtFull, fmtNum, niceTicks, r2, sVar, svgDoc, textW, trunc, } from './svg.js';
3
+ import { esc, fmtFull, fmtNum, niceTicks, r2, roundEdgeRect, sVar, svgDoc, textW, trunc, } from './svg.js';
4
4
  const PAD = 24;
5
5
  const LEGEND_H = 26;
6
6
  const VALUE_W = 62; // 外端数值那一列的宽(具体数字要放得下 ✓)
@@ -20,10 +20,13 @@ function tierGroups(tiers) {
20
20
  return out;
21
21
  }
22
22
  /** 档位名列:组名竖排在组中间(组太矮就排在组首行上) */
23
- /** 一根柱 */
24
- function bar(x0, y, len, h, color, tip, row = -1) {
23
+ /** tooltip 的属性(文字 ⇒ 属性 ✓ —— 别把整串属性再塞进属性里 ✗) */
24
+ const tipAttr = (text) => (text ? ` data-tip="${esc(text)}"` : '');
25
+ /** 一根柱:圆角只给**值那一端** ✓(#130 —— 起点贴着基线/中轴,圆了像悬空 ✗) */
26
+ function bar(x0, y, len, h, color, tip, row = -1, edge = 'right') {
27
+ const w = Math.max(len, 1);
25
28
  return [
26
- `<rect${row >= 0 ? ` data-row="${row}"` : ''} x="${r2(x0)}" y="${r2(y)}" width="${r2(Math.max(len, 1))}" height="${r2(h)}" rx="4" fill="${color}"${tip ? ` data-tip="${esc(tip)}"` : ''}/>`,
29
+ `<path${row >= 0 ? ` data-row="${row}"` : ''} d="${roundEdgeRect(x0, y, w, h, 4, edge)}" fill="${color}"${tipAttr(tip)}/>`,
27
30
  ];
28
31
  }
29
32
  /**
@@ -32,7 +35,7 @@ function bar(x0, y, len, h, color, tip, row = -1) {
32
35
  * 它同时是这一行的「悬停热区」✓ —— 悬在行里的空白处也能亮 ✓。
33
36
  */
34
37
  function rowBand(x, y, w, h, row, tip) {
35
- return `<rect class="row-band" data-row="${row}" x="${r2(x)}" y="${r2(y)}" width="${r2(w)}" height="${r2(h)}" fill="var(--d-ink)" fill-opacity="0"${tip ? ` ${tip}` : ''}/>`;
38
+ return `<rect class="row-band" data-row="${row}" x="${r2(x)}" y="${r2(y)}" width="${r2(w)}" height="${r2(h)}" fill="var(--d-ink)" fill-opacity="0"${tipAttr(tip)}/>`;
36
39
  }
37
40
  /**
38
41
  * 天梯图(单边)。
@@ -45,7 +48,7 @@ function rowBand(x, y, w, h, row, tip) {
45
48
  * (NVIDIA 绿 / AMD 红 / Intel 蓝 ✓ —— 「各自的主题色」✓)
46
49
  */
47
50
  const BRAND_COLOR = [
48
- [/nvidia|geforce|\brtx\b/i, '#76B900'],
51
+ [/nvidia|geforce|\brtx\b|quadro|titan|tesla/i, '#76B900'],
49
52
  [/amd|radeon|ryzen|epyc/i, '#ED1C24'],
50
53
  [/intel|\barc\b|\bcore\b|xeon/i, '#0071C5'],
51
54
  ];
@@ -56,6 +59,24 @@ function brandOf(name) {
56
59
  return c;
57
60
  return undefined;
58
61
  }
62
+ /** 颜色 ⇒ 牌子名(给图例用 ✓) */
63
+ const BRAND_NAME = { '#76B900': 'NVIDIA', '#ED1C24': 'AMD', '#0071C5': 'Intel' };
64
+ /**
65
+ * 图例:**图里真用到的那些颜色** ✓
66
+ * (不是「这一侧叫什么」✓ —— 一侧里混着 AMD 和 Intel 时,一个色块说不清 ✓;
67
+ * 牌子认得出来的就用牌子名 ✓,认不出来的才用这一侧的名字 ✓)
68
+ */
69
+ function legendOf(groups) {
70
+ const seen = new Map();
71
+ for (const g of groups) {
72
+ for (const it of g.items) {
73
+ const c = itemColor(it, g.side, g.fallback);
74
+ if (!seen.has(c))
75
+ seen.set(c, BRAND_NAME[c] ?? g.side?.name ?? '');
76
+ }
77
+ }
78
+ return [...seen].filter(([, n]) => n !== '').map(([color, name]) => ({ name, color }));
79
+ }
59
80
  /** 这一侧用什么颜色:显式给的 ✓ → 名字里的品牌 ✓ → 缺省的序列色 ✓ */
60
81
  function sideColor(side, fallback) {
61
82
  if (!side)
@@ -65,7 +86,7 @@ function sideColor(side, fallback) {
65
86
  return brandOf(side.name ?? '') ?? fallback;
66
87
  }
67
88
  /** 名字前面的牌子:要去就去掉 ✓(「GeForce RTX 5090」→「RTX 5090」✓) */
68
- const BRAND_WORDS = /^(nvidia|geforce|amd|radeon|ryzen|epyc|intel|core|xeon|arc)\s+/i;
89
+ const BRAND_WORDS = /^(nvidia|geforce|quadro|amd|radeon|ryzen|epyc|intel|core|xeon|arc)\s+/i;
69
90
  function stripped(label, spec) {
70
91
  const s = label ?? '';
71
92
  return spec.stripbrand ? s.replace(BRAND_WORDS, '') : s;
@@ -89,7 +110,7 @@ export function renderLadder(spec, o) {
89
110
  ? `<text x="${PAD}" y="${PAD + 17}" font-size="22" font-weight="600" letter-spacing="-0.02em" fill="var(--d-ink)">${esc(spec.title)}</text>`
90
111
  : '';
91
112
  const titleH = spec.title ? 38 : 0;
92
- const legendItems = side?.name ? [{ name: side.name, color: sideColor(side, 'var(--d-s1)') }] : [];
113
+ const legendItems = legendOf([{ items, side, fallback: 'var(--d-s1)' }]);
93
114
  const contentTop = PAD + titleH + (legendItems.length ? LEGEND_H : 0);
94
115
  // 行多的时候画布自动拉高 —— 行距压到 16 以下,行标签就叠在一起了
95
116
  // (h= 只是「最少这么高」✓:100 行的天梯图硬压进 480px ⇒ 后半截掉出画布 ✗)
@@ -128,16 +149,17 @@ export function renderLadder(spec, o) {
128
149
  const len = x(it.value) - left;
129
150
  const color = itemColor(it, side, sVar(0)); // 每张卡按自己的牌子 ✓
130
151
  const tip = o.interactive
131
- ? ` data-tip="${esc(`${it.label ?? ''} · ${fmtFull(it.value)}${spec.unit ? ' ' + spec.unit : ''}`)}"`
132
- : '';
152
+ ? `${it.label ?? ''} · ${fmtFull(it.value)}${spec.unit ? ' ' + spec.unit : ''}`
153
+ : undefined;
154
+ const tipA = tipAttr(tip);
133
155
  const row = ` data-row="${i}"`;
134
156
  // 行底色(悬停整行亮 ✓)—— 画在柱与字之前,垫在最下面 ✓
135
157
  parts.push(rowBand(PAD, contentTop + i * pitch, right - PAD, pitch, i, tip));
136
- parts.push(...bar(left, y, len, barH, color, tip, i));
158
+ parts.push(...bar(left, y, len, barH, color, tip, i, 'right'));
137
159
  if (it.label) {
138
- parts.push(`<text${row}${tip} x="${r2(PAD)}" y="${r2(y + barH / 2 + 4)}" text-anchor="start" font-size="12.5" fill="var(--d-text)">${esc(trunc(stripped(it.label, spec), cap))}</text>`);
160
+ parts.push(`<text${row}${tipA} x="${r2(PAD)}" y="${r2(y + barH / 2 + 4)}" text-anchor="start" font-size="12.5" fill="var(--d-text)">${esc(trunc(stripped(it.label, spec), cap))}</text>`);
139
161
  }
140
- parts.push(`<text${row} x="${r2(right + 8)}" y="${r2(y + barH / 2 + 4)}" font-size="12" font-weight="600" fill="var(--d-text)"${tip}>${fmtFull(it.value)}</text>`);
162
+ parts.push(`<text${row} x="${r2(right + 8)}" y="${r2(y + barH / 2 + 4)}" font-size="12" font-weight="600" fill="var(--d-text)"${tipA}>${fmtFull(it.value)}</text>`);
141
163
  });
142
164
  const legend = legendItems.length
143
165
  ? `<g data-legend="types">${legendItems.map((l, i) => `<rect x="${r2(PAD + i * 130)}" y="${r2(contentTop - LEGEND_H + 5)}" width="15" height="15" rx="4" fill="${l.color}" fill-opacity="0.2" stroke="${l.color}" stroke-opacity="0.55"/><text x="${r2(PAD + i * 130 + 22)}" y="${r2(contentTop - LEGEND_H + 17)}" font-size="12" fill="var(--d-muted)">${esc(l.name)}</text>`).join('')}</g>`
@@ -163,10 +185,10 @@ export function renderButterflyLadder(spec, o) {
163
185
  if (!n) {
164
186
  return svgDoc(width, o.height, 'butterfly-ladder', version, 'butterfly ladder', spec, skin, '');
165
187
  }
166
- const legendItems = [
167
- spec.left?.name ? { name: spec.left.name, color: sideColor(spec.left, 'var(--d-s1)') } : null,
168
- spec.right?.name ? { name: spec.right.name, color: sideColor(spec.right, 'var(--d-s2)') } : null,
169
- ].filter(Boolean);
188
+ const legendItems = legendOf([
189
+ { items: leftItems, side: spec.left, fallback: 'var(--d-s1)' },
190
+ { items: rightItems, side: spec.right, fallback: 'var(--d-s2)' },
191
+ ]);
170
192
  const titleSvg = spec.title
171
193
  ? `<text x="${PAD}" y="${PAD + 17}" font-size="22" font-weight="600" letter-spacing="-0.02em" fill="var(--d-ink)">${esc(spec.title)}</text>`
172
194
  : '';
@@ -220,33 +242,35 @@ export function renderButterflyLadder(spec, o) {
220
242
  const row = ` data-row="${i}"`;
221
243
  // 行底色(悬停整行亮 ✓)—— 一行两翼一起亮 ✓
222
244
  const bandTip = o.interactive
223
- ? ` data-tip="${esc(`${l?.label ?? ''}${r?.label ? ` · ${r.label}` : ''}`)}"`
224
- : '';
245
+ ? `${l?.label ?? ''}${r?.label ? ` · ${r.label}` : ''}`
246
+ : undefined;
225
247
  parts.push(rowBand(PAD, contentTop + i * pitch, width - PAD * 2, pitch, i, bandTip));
226
248
  if (l) {
227
249
  const len = (l.value / (leftMax || 1)) * half;
228
250
  const tip = o.interactive
229
- ? ` data-tip="${esc(`${l.label ?? ''} · ${fmtFull(l.value)}${spec.unit ? ' ' + spec.unit : ''}`)}"`
230
- : '';
231
- parts.push(...bar(centre - len, y, len, barH, itemColor(l, spec.left, sVar(0)), tip, i));
251
+ ? `${l.label ?? ''} · ${fmtFull(l.value)}${spec.unit ? ' ' + spec.unit : ''}`
252
+ : undefined;
253
+ const tipA = tipAttr(tip);
254
+ parts.push(...bar(centre - len, y, len, barH, itemColor(l, spec.left, sVar(0)), tip, i, 'left'));
232
255
  if (l.label) {
233
- parts.push(`<text${row}${tip} x="${r2(PAD)}" y="${r2(y + barH / 2 + 4)}" text-anchor="start" font-size="12.5" fill="var(--d-text)">${esc(trunc(stripped(l.label, spec), cap))}</text>`);
256
+ parts.push(`<text${row}${tipA} x="${r2(PAD)}" y="${r2(y + barH / 2 + 4)}" text-anchor="start" font-size="12.5" fill="var(--d-text)">${esc(trunc(stripped(l.label, spec), cap))}</text>`);
234
257
  }
235
258
  // 数值:**一律画在 bar 外面** ✓(两边一致 ✓ —— 「左边的数据在 bar 里、右边在外面」看着别扭 ✓)
236
259
  // 左边的柱往左长 ⇒ 数值在尾端的左边 ✓(紧挨着名字列 ✓)
237
- parts.push(`<text${row} x="${r2(centre - len - 8)}" y="${r2(y + barH / 2 + 4)}" text-anchor="end" font-size="12" font-weight="600" fill="var(--d-text)"${tip}>${fmtFull(l.value)}</text>`);
260
+ parts.push(`<text${row} x="${r2(centre - len - 8)}" y="${r2(y + barH / 2 + 4)}" text-anchor="end" font-size="12" font-weight="600" fill="var(--d-text)"${tipA}>${fmtFull(l.value)}</text>`);
238
261
  }
239
262
  if (r) {
240
263
  const len = (r.value / (rightMax || 1)) * half;
241
264
  const tip = o.interactive
242
- ? ` data-tip="${esc(`${r.label ?? ''} · ${fmtFull(r.value)}${spec.unit ? ' ' + spec.unit : ''}`)}"`
243
- : '';
244
- parts.push(...bar(centre, y, len, barH, itemColor(r, spec.right, sVar(1)), tip, i));
265
+ ? `${r.label ?? ''} · ${fmtFull(r.value)}${spec.unit ? ' ' + spec.unit : ''}`
266
+ : undefined;
267
+ const tipA = tipAttr(tip);
268
+ parts.push(...bar(centre, y, len, barH, itemColor(r, spec.right, sVar(1)), tip, i, 'right'));
245
269
  if (r.label) {
246
- parts.push(`<text${row}${tip} x="${r2(plotR + VALUE_W + 10)}" y="${r2(y + barH / 2 + 4)}" font-size="12.5" fill="var(--d-text)">${esc(trunc(stripped(r.label, spec), cap))}</text>`);
270
+ parts.push(`<text${row}${tipA} x="${r2(plotR + VALUE_W + 10)}" y="${r2(y + barH / 2 + 4)}" font-size="12.5" fill="var(--d-text)">${esc(trunc(stripped(r.label, spec), cap))}</text>`);
247
271
  }
248
272
  // 右边同样:**一律画在 bar 外面** ✓
249
- parts.push(`<text${row} x="${r2(centre + len + 8)}" y="${r2(y + barH / 2 + 4)}" text-anchor="start" font-size="12" font-weight="600" fill="var(--d-text)"${tip}>${fmtFull(r.value)}</text>`);
273
+ parts.push(`<text${row} x="${r2(centre + len + 8)}" y="${r2(y + barH / 2 + 4)}" font-size="12" font-weight="600" fill="var(--d-text)"${tipA}>${fmtFull(r.value)}</text>`);
250
274
  }
251
275
  });
252
276
  const legend = legendItems.length
@@ -83,6 +83,16 @@ export declare function smoothPath(pts: [number, number][]): string;
83
83
  * 相邻两段短于 2r 就自动收小(免得弧画到线外面去)。
84
84
  */
85
85
  export declare function roundedPath(pts: readonly [number, number][], r?: number): string;
86
+ /**
87
+ * 圆角只落在**指定的那一边**的矩形路径(x-cmd-hub/draw#130)。
88
+ *
89
+ * 条形图的规矩:**只有条的结束端才圆角** ✓ —— 起点贴着轴,圆了像悬空 ✗;
90
+ * 堆叠的中段接缝圆了像断成两截 ✗。`<rect rx>` 四角一起圆,说不清这个话,
91
+ * 所以按边给圆角,其余角是直角。
92
+ *
93
+ * @param edge 条往哪个方向长(圆角给那一头):'right' = 往右长,'left' = 往左长 …
94
+ */
95
+ export declare function roundEdgeRect(x: number, y: number, w: number, h: number, r: number, edge: 'left' | 'right' | 'top' | 'bottom'): string;
86
96
  export declare function onColor(hex: string): string;
87
97
  export declare class LabelPlacer {
88
98
  private boxes;
@@ -379,6 +379,30 @@ export function roundedPath(pts, r = 8) {
379
379
  d += `L${r2(last[0])} ${r2(last[1])}`;
380
380
  return d;
381
381
  }
382
+ /**
383
+ * 圆角只落在**指定的那一边**的矩形路径(x-cmd-hub/draw#130)。
384
+ *
385
+ * 条形图的规矩:**只有条的结束端才圆角** ✓ —— 起点贴着轴,圆了像悬空 ✗;
386
+ * 堆叠的中段接缝圆了像断成两截 ✗。`<rect rx>` 四角一起圆,说不清这个话,
387
+ * 所以按边给圆角,其余角是直角。
388
+ *
389
+ * @param edge 条往哪个方向长(圆角给那一头):'right' = 往右长,'left' = 往左长 …
390
+ */
391
+ export function roundEdgeRect(x, y, w, h, r, edge) {
392
+ const rr = Math.max(0, Math.min(r, w / 2, h / 2));
393
+ const tl = edge === 'left' || edge === 'top' ? rr : 0;
394
+ const tr = edge === 'right' || edge === 'top' ? rr : 0;
395
+ const br = edge === 'right' || edge === 'bottom' ? rr : 0;
396
+ const bl = edge === 'left' || edge === 'bottom' ? rr : 0;
397
+ // 半径为 0 的角不画弧(相邻的直线本来就在角点上相遇 ✓ —— 零半径的弧是废笔画)
398
+ const arc = (rad, px, py) => rad > 0.01 ? `A${r2(rad)} ${r2(rad)} 0 0 1 ${r2(px)} ${r2(py)}` : '';
399
+ return `M${r2(x + tl)} ${r2(y)}` +
400
+ `L${r2(x + w - tr)} ${r2(y)}` + arc(tr, x + w, y + tr) +
401
+ `L${r2(x + w)} ${r2(y + h - br)}` + arc(br, x + w - br, y + h) +
402
+ `L${r2(x + bl)} ${r2(y + h)}` + arc(bl, x, y + h - bl) +
403
+ `L${r2(x)} ${r2(y + tl)}` + arc(tl, x + tl, y) +
404
+ 'Z';
405
+ }
382
406
  // 按底色亮度选字色:亮底→墨色,深底→白色
383
407
  export function onColor(hex) {
384
408
  const h = hex.replace('#', '');
@@ -68,7 +68,15 @@ export interface Rules {
68
68
  num: 'all' | 'peak' | 'none';
69
69
  }
70
70
  export declare const DEFAULT_RULES: Rules;
71
- /** 基础中性色(规范页页面底色体系:#F8F9FB/#FFFFFF · #0A0A0A/#0E0F11) */
71
+ /**
72
+ * 基础中性色。
73
+ *
74
+ * 底色带**蓝/紫的色相**(#131):以前的纯白/近黑与宿主页面几乎同色,
75
+ * 图贴在白底/黑屏上都「浮不上来」✗。统一成一个淡 indigo 家族 ——
76
+ * 亮色是极浅的 periwinkle,暗色是深蓝紫;两边都带一点色相,
77
+ * 图是图、页是页 ✓(先把色相统一,后面再细调 ✓)。
78
+ * 文字/网格仍是无彩的 —— 底色有相,内容无相,数据不与底色抢 ✓。
79
+ */
72
80
  export declare const NEUTRALS: Neutrals;
73
81
  /** 变体输入(宽松):rules/neutrals 只给差异,makeVariant 补全默认 */
74
82
  export interface VariantInput {
@@ -50,17 +50,25 @@ export const DEFAULT_RULES = {
50
50
  legendCols: 0,
51
51
  num: 'all',
52
52
  };
53
- /** 基础中性色(规范页页面底色体系:#F8F9FB/#FFFFFF · #0A0A0A/#0E0F11) */
53
+ /**
54
+ * 基础中性色。
55
+ *
56
+ * 底色带**蓝/紫的色相**(#131):以前的纯白/近黑与宿主页面几乎同色,
57
+ * 图贴在白底/黑屏上都「浮不上来」✗。统一成一个淡 indigo 家族 ——
58
+ * 亮色是极浅的 periwinkle,暗色是深蓝紫;两边都带一点色相,
59
+ * 图是图、页是页 ✓(先把色相统一,后面再细调 ✓)。
60
+ * 文字/网格仍是无彩的 —— 底色有相,内容无相,数据不与底色抢 ✓。
61
+ */
54
62
  export const NEUTRALS = {
55
63
  ink: duo('#09090B', '#FAFAFA'),
56
64
  text: duo('#3F3F46', '#D4D4D8'),
57
65
  muted: duo('#71717A', '#A1A1AA'),
58
66
  faint: duo('#A1A1AA', '#71717A'),
59
- grid: duo('#ECECEF', '#29292E'),
67
+ grid: duo('#ECECF2', '#2A2B36'),
60
68
  baseline: duo('#D4D4D8', '#3F3F46'),
61
- border: duo('#E4E4E7', '#27272A'),
62
- card: duo('#FFFFFF', '#0E0F11'),
63
- halo: duo('#FFFFFF', '#1A1B1D'),
69
+ border: duo('#DFE2EF', '#2B2D3D'),
70
+ card: duo('#F5F6FC', '#12131F'),
71
+ halo: duo('#F5F6FC', '#1A1C2A'),
64
72
  };
65
73
  export function makeVariant(v) {
66
74
  const rules = { ...DEFAULT_RULES, ...v.rules };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-cmd/draw",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "SVG chart rendering as a service, a library, and a CLI — pie/bar/hbar/line/area/radar/gauge/scatter/combo/sankey/qr, same params everywhere",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",