@ww_nero/skills 2.4.4 → 2.4.6
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/assets/svg_to_pptx.py +13 -5
- package/index.js +6 -3
- package/package.json +1 -1
package/assets/svg_to_pptx.py
CHANGED
|
@@ -303,7 +303,7 @@ def add_rectangle(slide, x, y, width, height, fill_color, opacity=1.0, rx=0, str
|
|
|
303
303
|
|
|
304
304
|
if stroke_color and stroke_width > 0:
|
|
305
305
|
shape.line.color.rgb = hex_to_rgb(stroke_color)
|
|
306
|
-
shape.line.width =
|
|
306
|
+
shape.line.width = int(stroke_width * 9525)
|
|
307
307
|
# 设置边框透明度
|
|
308
308
|
if stroke_opacity is not None and stroke_opacity < 1.0:
|
|
309
309
|
set_line_stroke_transparency(shape, stroke_opacity)
|
|
@@ -372,7 +372,7 @@ def add_ellipse(slide, cx, cy, rx, ry, fill_color=None, stroke_color=None, strok
|
|
|
372
372
|
|
|
373
373
|
if stroke_color:
|
|
374
374
|
shape.line.color.rgb = hex_to_rgb(stroke_color)
|
|
375
|
-
shape.line.width =
|
|
375
|
+
shape.line.width = int(stroke_width * 9525)
|
|
376
376
|
# 设置边框透明度
|
|
377
377
|
if stroke_opacity is not None and stroke_opacity < 1.0:
|
|
378
378
|
set_line_stroke_transparency(shape, stroke_opacity)
|
|
@@ -419,7 +419,7 @@ def add_triangle(slide, cx, cy, size, fill_color, opacity=1.0, rotation=0, strok
|
|
|
419
419
|
shape.rotation = rotation
|
|
420
420
|
if stroke_color and stroke_width > 0:
|
|
421
421
|
shape.line.color.rgb = hex_to_rgb(stroke_color)
|
|
422
|
-
shape.line.width =
|
|
422
|
+
shape.line.width = int(stroke_width * 9525)
|
|
423
423
|
# 设置边框透明度
|
|
424
424
|
if stroke_opacity is not None and stroke_opacity < 1.0:
|
|
425
425
|
set_line_stroke_transparency(shape, stroke_opacity)
|
|
@@ -443,7 +443,7 @@ def add_spline(slide, points, color, width=2, opacity=1.0, smooth=True):
|
|
|
443
443
|
shape = builder.convert_to_shape()
|
|
444
444
|
shape.fill.background()
|
|
445
445
|
shape.line.color.rgb = hex_to_rgb(color)
|
|
446
|
-
shape.line.width =
|
|
446
|
+
shape.line.width = int(width * 9525)
|
|
447
447
|
if opacity < 1.0:
|
|
448
448
|
set_line_transparency(shape, opacity)
|
|
449
449
|
return shape
|
|
@@ -502,7 +502,7 @@ def add_polyline(slide, points, color, width=1, opacity=1.0, dash=False):
|
|
|
502
502
|
shape = builder.convert_to_shape()
|
|
503
503
|
shape.fill.background()
|
|
504
504
|
shape.line.color.rgb = hex_to_rgb(color)
|
|
505
|
-
shape.line.width =
|
|
505
|
+
shape.line.width = int(width * 9525)
|
|
506
506
|
if dash:
|
|
507
507
|
shape.line.dash_style = 2
|
|
508
508
|
if opacity < 1.0:
|
|
@@ -743,6 +743,14 @@ def create_slide(prs):
|
|
|
743
743
|
stroke="#00e5ff" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"/>'''
|
|
744
744
|
add_icon(slide, icon_svg, 1100, 650, 24, 24)
|
|
745
745
|
|
|
746
|
+
# Emoji 演示:emoji 可以像普通文本一样直接插入
|
|
747
|
+
# SVG: <text x="200" y="650" font-size="32" fill="#ffffff">🚀</text>
|
|
748
|
+
add_text_box(slide, "🚀", 200, 650, 50, 40, 32, "#ffffff", anchor='start', valign='top')
|
|
749
|
+
# SVG: <text x="260" y="650" font-size="32" fill="#ffffff">🤖</text>
|
|
750
|
+
add_text_box(slide, "🤖", 260, 650, 50, 40, 32, "#ffffff", anchor='start', valign='top')
|
|
751
|
+
# SVG: <text x="320" y="650" font-size="32" fill="#ffffff">🧠</text>
|
|
752
|
+
add_text_box(slide, "🧠", 320, 650, 50, 40, 32, "#ffffff", anchor='start', valign='top')
|
|
753
|
+
|
|
746
754
|
def main():
|
|
747
755
|
prs = Presentation()
|
|
748
756
|
prs.slide_width = px(1280)
|
package/index.js
CHANGED
|
@@ -122,7 +122,8 @@ const SNIPPETS = {
|
|
|
122
122
|
'【渐变透明度】每个渐变停止点的透明度需在对应 srgbClr 下追加 a:alpha 元素,val 值为透明度*100000(如 0.5 透明度对应 50000)。',
|
|
123
123
|
'【曲线绘制】使用 build_freeform 绘制曲线时,起点坐标在构造器中指定,后续点通过 add_line_segments 添加。若需平滑曲线,可用 Catmull-Rom 样条插值生成中间点。',
|
|
124
124
|
'【线宽单位换算】线条宽度不能使用 Pt,应使用 EMU 单位:width * 9525(1px 约等于 9525 EMU)。',
|
|
125
|
-
'【移除阴影效果】对于线条、非封闭的 freeform path、以及只有 stroke 没有 fill 的 circle,需要移除默认阴影效果,方法是在 spPr 下添加空的 a:effectLst 元素。'
|
|
125
|
+
'【移除阴影效果】对于线条、非封闭的 freeform path、以及只有 stroke 没有 fill 的 circle,需要移除默认阴影效果,方法是在 spPr 下添加空的 a:effectLst 元素。',
|
|
126
|
+
'【Emoji 处理】Emoji 可以像普通文本一样直接插入到 PPT 中,使用 add_text_box 函数即可,无需特殊处理。'
|
|
126
127
|
]
|
|
127
128
|
}
|
|
128
129
|
};
|
|
@@ -182,13 +183,15 @@ const GUIDES = {
|
|
|
182
183
|
1. **规划PPT内容**,存储到markdown文件中:
|
|
183
184
|
- 每页Slide的规划需要包含:内容、布局方式、插图(只有用户明确提出要求时才添加插图)
|
|
184
185
|
- 不同页面应尽可能使用不同的布局方式,避免过于单调,可适当使用图表来呈现信息,例如折线图、柱状图、饼状图等;各正文页面背景和标题样式应保持一致
|
|
185
|
-
- 如果用户未明确提出要求,则页面默认比例为宽1280px、高720px
|
|
186
|
+
- 如果用户未明确提出要求,则页面默认比例为宽1280px、高720px,默认背景为象牙白(#FFFFF0)、弱渐变、商务简约、扁平化风格
|
|
186
187
|
- 如果需要插入图片,则按照以下方式:
|
|
187
188
|
- 收集图片素材,优先使用用户提供的图片;如未提供,则使用图片生成工具生成合适的图片
|
|
188
189
|
- 将图片素材保存到\`images\`文件夹中,通过python脚本获取每个图片的宽高比例,然后对每张图片进行重命名,通过名称标识图片的内容及宽高比例,例如\`main_background_16_9.png\`表示该图片是主背景图,宽高比为16:9;对于用户提供的图片素材,可调用工具解读图片内容
|
|
189
190
|
|
|
190
191
|
2. **通过SVG代码实现Slides的排版**:
|
|
191
192
|
- 如需插图,统一使用\`rect\`或\`circle\`元素进行占位(必须符合图片宽高比例),占位元素应设置合适的位置,可添加浅色填充或边框以便预览时识别
|
|
193
|
+
- 如需图标,优先使用Emoji,其次使用纯代码的方式绘制
|
|
194
|
+
- 如需图表,如折线图、柱状图等,应使用纯代码的方式绘制,而不是使用图片占位元素
|
|
192
195
|
- 所有Slide的页面共同保存在一个HTML文件中。
|
|
193
196
|
|
|
194
197
|
3. **把SVG转成PPTX文件**:
|
|
@@ -281,7 +284,7 @@ const listTools = () => ({
|
|
|
281
284
|
]
|
|
282
285
|
});
|
|
283
286
|
|
|
284
|
-
const server = new Server({ name: 'skills', version: '2.4.
|
|
287
|
+
const server = new Server({ name: 'skills', version: '2.4.6' }, { capabilities: { tools: {} } });
|
|
285
288
|
|
|
286
289
|
server.setRequestHandler(ListToolsRequestSchema, async () => listTools());
|
|
287
290
|
|