xw-devtool-cli 1.0.37 → 1.0.38
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 +88 -54
- package/package.json +4 -3
- package/src/index.js +25 -3
package/README.md
CHANGED
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
- **图片分割**:支持网格等分(自定义行/列数)或自定义分割线(像素/百分比),自动生成分割后的图片文件。
|
|
16
16
|
- **图片主色识别**:提取图片主色调(Hex/RGB/HSL/HSV),默认复制 Hex 到剪贴板,支持保存详细信息到文件。
|
|
17
17
|
- **颜色吸取**:从图片中吸取单像素颜色或区域平均颜色,支持 px/% 坐标输入,结果显示颜色条并自动复制 Hex/Hex8。
|
|
18
|
-
-
|
|
19
|
-
>
|
|
20
|
-
> 1.
|
|
21
|
-
> 2.
|
|
22
|
-
> 3.
|
|
18
|
+
- **屏幕取色**:实时显示鼠标所在位置的颜色值(Hex/RGB)。
|
|
19
|
+
> **操作说明**:
|
|
20
|
+
> 1. 进入模式后,屏幕右下角会实时显示当前颜色预览和数值。
|
|
21
|
+
> 2. 移动鼠标到目标位置,按 **Enter 键** 复制当前颜色 Hex 到剪贴板(会有成功提示)。
|
|
22
|
+
> 3. 按 **ESC 键** 退出取色模式。
|
|
23
|
+
> 4. 支持多显示器。
|
|
23
24
|
- **占位图生成**:快速生成指定尺寸、颜色、文字的占位图片 (Placeholder Image)。
|
|
24
|
-
-
|
|
25
|
+
- **全屏十字辅助线**:显示跟随鼠标的全屏红色十字线,用于屏幕对齐和定位。按 **ESC 键** 退出。
|
|
25
26
|
- **屏幕测距**:点击屏幕上任意两点,测量其像素距离。
|
|
26
27
|
- **屏幕文字标注**:在屏幕上点击并输入文字,进行临时标注。右键撤销,Delete 清空。
|
|
27
28
|
- **图片压缩**:支持文件或文件夹;文件夹可批量压缩其下所有图片(可选包含子文件夹)。支持 PNG/JPG/WebP,质量 1-100;输出文件名带时间戳并复制输出目录到剪贴板。
|
|
@@ -100,29 +101,38 @@ xw-devtool --en # 英文启动 (Start in English)
|
|
|
100
101
|
=================================
|
|
101
102
|
xw-devtool-cli 菜单
|
|
102
103
|
=================================
|
|
103
|
-
1. 图片
|
|
104
|
+
1. 图片 <-> Base64
|
|
104
105
|
2. 图片格式转换
|
|
105
|
-
3.
|
|
106
|
+
3. 图片分割工具
|
|
106
107
|
4. 图片主色识别
|
|
107
|
-
5.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
108
|
+
5. 颜色吸取
|
|
109
|
+
6. 全屏十字辅助线
|
|
110
|
+
7. 屏幕测距 (像素)
|
|
111
|
+
8. 屏幕文字标注
|
|
112
|
+
9. 图片压缩
|
|
113
|
+
a. 占位图生成器
|
|
114
|
+
b. 二维码生成器
|
|
115
|
+
c. URL 编码/解码
|
|
116
|
+
d. 进制转换工具
|
|
117
|
+
e. 字符串 编码/解码 (Base64)
|
|
118
|
+
f. Unicode 编码/解码
|
|
119
|
+
g. HTML 实体 编码/解码
|
|
120
|
+
h. 变量命名格式转换
|
|
121
|
+
i. JSON 格式化 (压缩/美化)
|
|
122
|
+
j. 汉字转拼音
|
|
123
|
+
k. 时间格式化 / 时间戳
|
|
124
|
+
l. 时间计算 (差值/偏移)
|
|
125
|
+
m. 颜色转换 (Hex <-> RGB)
|
|
126
|
+
n. 颜色预览
|
|
127
|
+
o. 生成 UUID
|
|
128
|
+
p. 哈希计算 (MD5/SHA/SM3)
|
|
129
|
+
q. Mock 文本生成
|
|
130
|
+
r. 特殊字符 (符号)
|
|
131
|
+
s. Emoji 选择器
|
|
132
|
+
t. Markdown 片段
|
|
133
|
+
u. VS Code 代码片段生成
|
|
134
|
+
v. Git 助手 (分支/提交模板)
|
|
135
|
+
w. 设置 / 语言 (Settings)
|
|
126
136
|
0. 退出
|
|
127
137
|
=================================
|
|
128
138
|
```
|
|
@@ -146,6 +156,20 @@ s. 设置 (语言)
|
|
|
146
156
|
- 生成的新图片将保存在源文件同级目录。
|
|
147
157
|
- 生成 ICO 时可自定义尺寸,留空默认生成 `256` 尺寸;输出文件名包含时间戳。
|
|
148
158
|
|
|
159
|
+
### 图片压缩
|
|
160
|
+
- 选择 `imgCompress` (菜单对应数字/字母) 进入。
|
|
161
|
+
- **支持输入**:
|
|
162
|
+
- **文件**:单张图片压缩。
|
|
163
|
+
- **文件夹**:批量压缩文件夹内所有图片(可选是否递归子文件夹)。
|
|
164
|
+
- **参数设置**:
|
|
165
|
+
- **质量**:推荐 80,也可自定义 1-100。
|
|
166
|
+
- **文件夹结构**:批量处理时可选保留原目录结构。
|
|
167
|
+
- **文件名后缀**:可选是否添加 `_compressed_时间戳` 后缀。如果不添加,将保持原文件名(建议输出到不同目录以防覆盖)。
|
|
168
|
+
- **输出**:
|
|
169
|
+
- 默认输出到源目录下的 `compressed_YYYYMMDD_HHmmss` 文件夹。
|
|
170
|
+
- 自动复制输出目录路径。
|
|
171
|
+
- 完成后可选直接打开输出目录。
|
|
172
|
+
|
|
149
173
|
### 3. 占位图生成 (Placeholder Image)
|
|
150
174
|
- 选择 `3` 进入。
|
|
151
175
|
- **模式 1:本地图片文件 (Local Image File)**
|
|
@@ -317,12 +341,15 @@ Key features include: Base64 encoding/decoding, image format conversion, image <
|
|
|
317
341
|
- **Image ↔ Base64**: Convert images to Base64 strings and vice versa.
|
|
318
342
|
- **Image Dominant Color**: Extract dominant color (Hex/RGB/HSL/HSV), copy Hex to clipboard by default, or save details to file.
|
|
319
343
|
- **Image Color Picker**: Pick color from image (single pixel or average), supports px/% coordinates, shows color bar and auto-copies Hex/Hex8.
|
|
320
|
-
- **Screen Color Picker**:
|
|
321
|
-
> **
|
|
322
|
-
> 1.
|
|
323
|
-
> 2.
|
|
324
|
-
> 3.
|
|
344
|
+
- **Screen Color Picker**: Real-time color picking from screen (Hex/RGB).
|
|
345
|
+
> **Usage**:
|
|
346
|
+
> 1. Real-time color preview and values are shown in the bottom-right corner.
|
|
347
|
+
> 2. Move mouse to target and press **Enter** to copy Hex color to clipboard.
|
|
348
|
+
> 3. Press **ESC** to exit.
|
|
349
|
+
> 4. Supports multiple monitors.
|
|
325
350
|
- **Placeholder Image**: Quickly generate placeholder images with custom size, color, and text.
|
|
351
|
+
- **Image Compression**: Support file or folder input; batch compress images in folder (recursive optional). Supports PNG/JPG/WebP, Quality 1-100. Output filename suffix optional.
|
|
352
|
+
- **Full Screen Crosshair**: Show red crosshair following mouse. Press **ESC** to exit.
|
|
326
353
|
- **Mock Data**:
|
|
327
354
|
- Generate: Lorem Ipsum, Chinese characters, ID cards, Emails, URLs, Order IDs, Phone numbers.
|
|
328
355
|
- Supports batch generation.
|
|
@@ -385,28 +412,22 @@ The interactive menu will appear:
|
|
|
385
412
|
=================================
|
|
386
413
|
xw-devtool-cli Menu
|
|
387
414
|
=================================
|
|
388
|
-
1. Image <-> Base64
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
h. Mock Text
|
|
405
|
-
i. Special Characters (Symbols)
|
|
406
|
-
j. Emoji Picker
|
|
407
|
-
k. Markdown Snippets
|
|
408
|
-
l. VS Code Snippet Generator
|
|
409
|
-
s. Settings (Language)
|
|
415
|
+
1. Image <-> Base64 2. Image Format Convert
|
|
416
|
+
3. Image Splitter 4. Image Dominant Color
|
|
417
|
+
5. Color Picker 6. Screen Crosshair
|
|
418
|
+
7. Pixel Distance Tool 8. Screen Mark Tool
|
|
419
|
+
9. Image Compression a. Placeholder Image Generator
|
|
420
|
+
b. QR Code Generator c. URL Encode/Decode
|
|
421
|
+
d. Number Base Converter e. String Encode/Decode (Base64)
|
|
422
|
+
f. Unicode Encode/Decode g. HTML Entity Encode/Decode
|
|
423
|
+
h. Variable Format Converter i. JSON Format (Minify/Prettify)
|
|
424
|
+
j. Chinese to Pinyin k. Time Format / Timestamp
|
|
425
|
+
l. Time Calculation (Diff/Offset) m. Color Converter (Hex <-> RGB)
|
|
426
|
+
n. Color Preview o. Get UUID
|
|
427
|
+
p. Hash Calculator (MD5/SHA/SM3) q. Mock Text
|
|
428
|
+
r. Special Characters (Symbols) s. Emoji Picker
|
|
429
|
+
t. Markdown Snippets u. VS Code Snippet Generator
|
|
430
|
+
v. Git Helper (Branch/Commit Template) w. Settings / Language
|
|
410
431
|
0. Exit
|
|
411
432
|
=================================
|
|
412
433
|
```
|
|
@@ -429,6 +450,19 @@ s. Settings (Language)
|
|
|
429
450
|
- Set quality/compression.
|
|
430
451
|
- Saved in the same directory.
|
|
431
452
|
|
|
453
|
+
#### Image Compression
|
|
454
|
+
- Select `imgCompress` (menu key).
|
|
455
|
+
- **Input**: File or Folder (batch processing).
|
|
456
|
+
- **Settings**:
|
|
457
|
+
- Quality (1-100).
|
|
458
|
+
- Recursive (for folders).
|
|
459
|
+
- Preserve directory structure.
|
|
460
|
+
- Suffix option: Add `_compressed_timestamp` or keep original filename.
|
|
461
|
+
- **Output**:
|
|
462
|
+
- Saved to `compressed_YYYYMMDD_HHmmss` folder.
|
|
463
|
+
- Auto-copy output path.
|
|
464
|
+
- Option to open output folder.
|
|
465
|
+
|
|
432
466
|
#### 3. Placeholder Image Generator
|
|
433
467
|
- Select `3`.
|
|
434
468
|
- **Mode 1: Local Image File**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xw-devtool-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.38",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "基于node的开发者助手cli",
|
|
6
6
|
"main": "index.js",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"url": "https://gitee.com/github-9819409/xw-devtool-cli/issues"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
+
"cli-table3": "^0.6.5",
|
|
77
78
|
"clipboardy": "^5.0.2",
|
|
78
79
|
"commander": "^14.0.2",
|
|
79
80
|
"dayjs": "^1.11.19",
|
|
@@ -85,7 +86,7 @@
|
|
|
85
86
|
"qrcode": "^1.5.4",
|
|
86
87
|
"sharp": "^0.33.5",
|
|
87
88
|
"tinycolor2": "^1.6.0",
|
|
88
|
-
"
|
|
89
|
-
"
|
|
89
|
+
"to-ico": "^1.1.5",
|
|
90
|
+
"uuid": "^13.0.0"
|
|
90
91
|
}
|
|
91
92
|
}
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import inquirer from 'inquirer';
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
+
import Table from 'cli-table3';
|
|
3
4
|
import i18next from './i18n.js';
|
|
4
5
|
import { saveConfig } from './utils/config.js';
|
|
5
6
|
|
|
@@ -134,10 +135,31 @@ async function showMenu() {
|
|
|
134
135
|
console.log('\n=================================');
|
|
135
136
|
console.log(` ${i18next.t('menu.title')}`);
|
|
136
137
|
console.log('=================================');
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
|
|
139
|
+
// Prepare items for table
|
|
140
|
+
const items = features.map((feature, index) => `${getFeatureKey(index)}. ${feature.name}`);
|
|
141
|
+
items.push(`0. ${i18next.t('menu.exit')}`);
|
|
142
|
+
|
|
143
|
+
// Configure table
|
|
144
|
+
const table = new Table({
|
|
145
|
+
chars: {
|
|
146
|
+
'top': '', 'top-mid': '', 'top-left': '', 'top-right': '',
|
|
147
|
+
'bottom': '', 'bottom-mid': '', 'bottom-left': '', 'bottom-right': '',
|
|
148
|
+
'left': '', 'left-mid': '', 'mid': '', 'mid-mid': '',
|
|
149
|
+
'right': '', 'right-mid': '', 'middle': ' '
|
|
150
|
+
},
|
|
151
|
+
style: { 'padding-left': 0, 'padding-right': 0 },
|
|
152
|
+
colWidths: [40, 40]
|
|
139
153
|
});
|
|
140
|
-
|
|
154
|
+
|
|
155
|
+
// Add items to table in pairs
|
|
156
|
+
const columns = 2;
|
|
157
|
+
for (let i = 0; i < items.length; i += columns) {
|
|
158
|
+
const row = items.slice(i, i + columns);
|
|
159
|
+
table.push(row);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
console.log(table.toString());
|
|
141
163
|
console.log('=================================\n');
|
|
142
164
|
|
|
143
165
|
const { choice } = await inquirer.prompt([
|