Design
从 ECharts 主题 JSON 抽取设计 token——颜色、数字、字号与字符串——并直接导出到你的设计系统。粘贴一个主题对象(即通过 echarts.init(dom, themeName) 注册的那种),工具遍历每个叶子节点,为每个颜色(可选地将命名色/rgb 规范化为 hex)、间距数字、字号与字符串打标,然后输出干净的 CSS 变量、Tailwind theme.extend 配置、Style Dictionary tokens.json 或 SCSS 变量。在 ECharts 可视化主题与 Figma/CSS/Tailwind 设计 token 之间架桥,无需逐个手抄。
用三种语言从你的代码中调用此工具。
curl -X POST 'https://api.elysiatools.com/zh/api/tools/echarts-theme-token-extractor' \
-H 'Content-Type: application/json' \
-d '{"themeJson":"{\n \"color\": [\"#5470c6\", \"#91cc75\", \"#fac858\"],\n \"backgroundColor\": \"rgb(255, 255, 255)\",\n \"textStyle\": { \"fontSize\": 12, \"color\": \"#333333\" }\n}","format":"css","prefix":"chart","colorMode":"hex"}'以 JSON 形式 POST 提交输入参数。文件类型参数需先单独上传。
POST https://api.elysiatools.com/zh/api/tools/echarts-theme-token-extractor| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| themeJson | textarea | 是 | — |
| format | select | 否 | — |
| prefix | text | 否 | — |
| colorMode | select | 否 | — |
HTML 结果
{
"result": "<div>Processed HTML content</div>",
"error": "Error message (optional)",
"message": "Notification message (optional)",
"metadata": {
"key": "value"
}
}将此工具加入你的 Model Context Protocol 服务,让 AI 智能体可以列出并调用它。
将以下内容加入你的 MCP 客户端配置:
{
"mcpServers": {
"elysiatools-echarts-theme-token-extractor": {
"name": "echarts-theme-token-extractor",
"description": "从 ECharts 主题 JSON 抽取设计 token——颜色、数字、字号与字符串——并直接导出到你的设计系统。粘贴一个主题对象(即通过 echarts.init(dom, themeName) 注册的那种),工具遍历每个叶子节点,为每个颜色(可选地将命名色/rgb 规范化为 hex)、间距数字、字号与字符串打标,然后输出干净的 CSS 变量、Tailwind theme.extend 配置、Style Dictionary tokens.json 或 SCSS 变量。在 ECharts 可视化主题与 Figma/CSS/Tailwind 设计 token 之间架桥,无需逐个手抄。",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=echarts-theme-token-extractor",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}连接到 SSE 端点后,列出已开放的工具:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}通过工具 id 调用,参数由其参数表构建:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "echarts-theme-token-extractor",
"arguments": {
"themeJson": "{\n \"color\": [\"#5470c6\", \"#91cc75\", \"#fac858\"],\n \"backgroundColor\": \"rgb(255, 255, 255)\",\n \"textStyle\": { \"fontSize\": 12, \"color\": \"#333333\" }\n}",
"format": "css",
"prefix": "chart",
"colorMode": "hex"
}
}
}有问题或反馈?请联系 [email protected]