闲社服务运行正常AI智能体自动化平台
T

表格转图片

技能标识:Table2Image

Convert markdown tables and JSON data to PNG images. Perfect for Discord, Telegram, and other platforms where markdown tables render poorly. Use when Claude needs to present tabular data in a visually appealing format, when sending tables to Discord/Telegram/WhatsApp, or when the user asks to convert a table to an image. Supports multiple themes (discord-light, discord-dark, finance, minimal), conditional formatting, and automatic markdown table detection.

作者:admin | 来源记录:ClawHub
登记来源
ClawHub
版本
V 1.1.0
检测标记
后台标记通过
免费
免费获取
1
收藏
来源与检测标记为平台登记信息,并不代表已展示可复核的检测报告。使用前请核对版本、依赖和所需权限,建议先在隔离环境中运行。
概述
安装方式
版本历史

表格转图片

Table2Image

🇬🇧 English | 🇨🇳 中文

将表格转换为漂亮的PNG图片,适用于聊天平台。

GitHub: https://github.com/UMRzcz-831/table-to-image-skill

技术栈: Playwright + Chromium,实现完美的表情符号和字体渲染。

前置条件

  • - Node.js: >= 18.0.0
  • 网络: 首次运行需要网络连接(Chromium下载约100MB)

安装

bash

安装依赖


npm install

下载Chromium(一次性,约100MB)

npx playwright install chromium

性能

指标时间
首次运行(Chromium下载)~30-60秒(一次性)
浏览器启动(首次渲染)
~2-3秒 | | 后续渲染 | < 500毫秒(浏览器复用) |

💡 提示: 首次渲染后浏览器实例会自动复用,使后续表格生成几乎瞬间完成。

快速开始

方法一:命令行(适用于简单表格)

bash

将JSON数据转换为表格图片


echo [{name:Alice,score:95}] | node scripts/table-cli.mjs --dark --output table.png

或使用JSON文件

node scripts/table-cli.mjs --data-file data.json --theme discord-dark --output table.png

方法二:编程API(推荐)

typescript
import { renderTable, renderDiscordTable } from ./scripts/index.js;

// 快速生成Discord表格
const image = await renderDiscordTable(
[{ name: AAPL, change: +2.5% }],
[
{ key: name, header: 股票 },
{ key: change, header: 涨跌幅, align: right }
],
📊 市场观察
);

// 发送到Discord
await message.send({ attachment: image.buffer });

方法三:自动转换Markdown表格

typescript
import { autoConvertMarkdownTable } from ./scripts/index.js;

// 自动检测并转换
const result = await autoConvertMarkdownTable(message, discord);
if (result.converted) {
await message.send({ attachment: result.image });
}

何时使用此技能

  • - Discord/Telegram/WhatsApp: 这些平台对Markdown表格渲染不佳
  • 金融数据: 股票价格、投资组合报告(带条件格式)
  • 排行榜: 带奖牌和颜色编码排名的榜单
  • 对比表格: 并排功能对比
  • 任何表格数据: 当视觉呈现很重要时

主题

主题最佳用途预览
discord-lightDiscord浅色模式(默认)discord-light
discord-dark
Discord深色模式 | discord-dark | | finance | 财务报告 | finance | | minimal | 简洁/简约 | minimal | | sweet-pink | 时尚深色+粉色点缀 | sweet-pink | | deep-sea | 经典蓝色+奶油白 | deep-sea | | wisteria | 复古紫色+青柠绿 | wisteria | | pond-blue | 深海军蓝+柔和青色 | pond-blue | | camellia | 暖红+淡粉 | camellia |

自定义主题

您也可以直接将自定义主题对象传递给theme。为方便起见,您只需提供两种颜色——primary和secondary——完整主题将自动生成:

typescript
const image = await renderTable({
data: [{ name: Alice, score: 95 }],
columns: [
{ key: name, header: 姓名 },
{ key: score, header: 分数, align: right }
],
theme: {
primary: #e6397c, // 强调色(表头、文字、边框)
secondary: #1a1a1d // 基础色(背景、行)
}
});

custom-primary-secondary

或者传递包含全部7种颜色的完整自定义主题对象:

typescript
const image = await renderTable({
data: [{ name: Alice, score: 95 }],
columns: [...],
theme: {
background: #1a1a1d,
headerBg: #e6397c,
headerText: #1a1a1d,
rowBg: #1a1a1d,
rowAltBg: #2a2a2d,
text: #e6397c,
border: #e6397c
}
});

custom-full

高级用法

条件格式

typescript
import { renderTable } from ./scripts/index.js;

const image = await renderTable({
data: stocks,
columns: [
{ key: symbol, header: 代码 },
{
key: change,
header: 涨跌幅,
align: right,
formatter: (v) => ${v > 0 ? + : }${v}%,
style: (v) => ({ color: v > 0 ? #43b581 : #f04747 })
}
],
theme: discord-dark
});

自定义列宽

typescript
columns: [
{ key: name, header: 名称, width: 150 },
{ key: description, header: 描述, width: 300, wrap: true, maxLines: 3 }
]

脚本

  • - scripts/table-cli.mjs - 命令行界面
  • scripts/index.js - 编程API

完整API文档请参见references/api.md。

示例

常见用例和代码示例请参见references/examples.md。

标签

skill ai

通过对话安装

以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 markdowntable2image-1775976434 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 markdowntable2image-1775976434 技能

通过命令行安装

skillhub install markdowntable2image-1775976434

下载

⬇ 下载 Table2Image v1.1.0(免费)

文件大小: 19.65 KB | 发布时间: 2026-4-13 10:56

v1.1.0 最新 2026-4-13 10:56
- Added 5 new built-in table themes: sweet-pink, deep-sea, wisteria, pond-blue, camellia.
- Introduced support for custom theme objects with automatic theme generation based on primary and secondary colors.
- Updated documentation to include previews and details for new and custom themes.
- No breaking changes; previous theme names and API usage remain compatible.
返回顶部