Token导航 LogoToken导航TokenDH.com
Color MCP (Inky Quill) logo
设计创作未说明官方级别未说明来源级核验

Color MCP (Inky Quill)

MCP Server

一个用于多种网页颜色格式转换的模型上下文协议(MCP)服务器,支持HEX、RGB、HSL等10+种格式的自动检测与转换,并提供色彩对比度和无障碍访问性分析。

工具数

4

提示词数

0

GitHub Stars

0

资源数

0
GoClaude设计Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

InkyQuill

提供方

InkyQuill

最后核验

2026/5/17 20:22

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

彩色MCP服务器

用于在各种网络颜色格式之间进行转换的模型上下文协议(MCP)服务器。此服务器提供用于检测颜色格式并在HEX、RGB、HSL、HSB/HSV、OKLCH、LAB、XYZ、HWB和CMYK格式之间转换颜色的工具。

特性

  • 自动检测:自动检测输入颜色格式
  • 多种格式:支持10多种颜色格式
  • Alpha通道:根据需要保留或剥离阿尔法通道
  • 颜色比较:使用OKLCHΔE进行感知相似性分析
  • 无障碍:WCAG对比度计算
  • 高精度:使用精确的颜色空间转换
  • 快速:纯Go实现,无外部依赖
  • 综合测试:>90%的测试覆盖率

支持的颜色格式

格式示例描述
六角形#FF0000, #FF000080十六进制RGB/RGBA
RGBrgb(255, 0, 0), rgb(100%, 0%, 0%)RGB颜色空间
RGBArgba(255, 0, 0, 0.5)带阿尔法的RGB
HSLhsl(0, 100%, 50%)色调、饱和度、亮度
HSLA公司hsla(0, 100%, 50%, 0.5)HSL与阿尔法
HSB/HSVhsb(0, 100%, 100%)色调、饱和度、亮度/值
关闭 oklch(0.5 0.1 120)感知均匀的颜色空间
实验室lab(50 50 50)CIE LAB颜色空间
XYZxyz(0.5 0.5 0.5)CIE XYZ颜色空间
HWBhwb(0 0% 0%)色调、白色、黑色
CMYKcmyk(0% 100% 100% 0%)青色、品红色、黄色、钥匙色(黑色)

安装

来源

# Clone the repository
git clone https://github.com/InkyQuill/color-mcp.git
cd color-mcp

# Build the binary
go build -o color-mcp

# (Optional) Install to system
sudo install color-mcp /usr/local/bin/

使用Go安装

go install github.com/InkyQuill/color-mcp@latest

MCP配置

添加到MCP客户端配置中(通常在 ~/.config/claude/mcp.json 或类似):

{
  "mcpServers": {
    "color-converter": {
      "command": "/path/to/color-mcp"
    }
  }
}

替换 /path/to/color-mcp 与二进制文件的实际路径(例如。, /usr/local/bin/color-mcp~/go/bin/color-mcp).

用法

可用工具

1.转换颜色

将颜色从一种格式转换为另一种格式。

参数:

  • color (string,必填):以任何支持的格式输入颜色值
  • target_format (字符串,必填):目标格式(十六进制、rgb、hsl、hsla、hsb、oklch、lab、xyz、hwb、cmyk)
  • preserve_alpha (布尔值,可选):是否保留alpha通道(默认值:true)

例子:

Convert #FF0000 to HSL format

2.检测格式

检测输入颜色字符串的格式。

参数:

  • color (字符串,必填):用于检测格式的颜色值

例子:

Detect the format of rgb(255, 0, 0)

3.列表格式

列出所有支持的颜色格式。

例子:

List all supported color formats

4.比较颜色

比较两种颜色的感知相似性、对比度和成分差异。

参数:

  • color1 (string,必填):任何支持格式的第一个颜色值
  • color2 (string,必填):任何支持格式的第二个颜色值
  • detailed (布尔值,可选):是否包含详细的组件分解(默认值:false)

例子:

Compare #FF0000 and #00FF00 with detailed output

结果(基本):

Color Comparison: #FF0000 vs #00FF00
Perceptual Difference: 0.520 ΔE
Verdict: different
Contrast Ratio: 2.91:1 (Fail)

结果(详细):

Color Comparison: #FF0000 (hex) vs #00FF00 (hex)

Perceptual Difference: 0.520 ΔE
Verdict: different

Component Breakdown:
  Hue Difference: 120.0°
  Lightness Difference: 0.0%
  Saturation Difference: 0.0%

Contrast Ratio: 2.91:1
WCAG Grade: Fail

例子

将HEX转换为HSL

Convert #FF5733 to hsl

结果:

Input color: #FF5733 (format: hex)
Output color: hsl(11, 100%, 60%) (format: hsl)
Alpha preserved: true

将RGB转换为OKLCH

Convert rgb(255, 0, 0) to oklch

结果:

Input color: rgb(255, 0, 0) (format: rgb)
Output color: oklch(0.6280 0.2577 29.23 / 1.00) (format: oklch)
Alpha preserved: true

检测颜色格式

Detect the format of hsl(120, 100%, 50%)

结果:

Color: hsl(120, 100%, 50%)
Detected format: hsl

阿尔法通道处理

Convert rgba(255, 0, 0, 0.5) to hex

结果:

Input color: rgba(255, 0, 0, 0.5) (format: rgba)
Output color: #FF000080 (format: hex)
Alpha preserved: true
Convert rgba(255, 0, 0, 0.5) to rgb without preserving alpha

结果:

Input color: rgba(255, 0, 0, 0.5) (format: rgba)
Output color: rgb(255, 0, 0) (format: rgb)
Alpha preserved: false

颜色比较

Compare #000000 and #FFFFFF

结果:

Color Comparison: #000000 vs #FFFFFF
Perceptual Difference: 1.000 ΔE
Verdict: different
Contrast Ratio: 21.00:1 (AAA)
Compare hsl(350, 100%, 50%) and hsl(10, 100%, 50%) with detailed output

结果:

Color Comparison: hsl(350, 100%, 50%) (hsl) vs hsl(10, 100%, 50%) (hsl)

Perceptual Difference: 0.032 ΔE
Verdict: slightly different

Component Breakdown:
  Hue Difference: 20.0°
  Lightness Difference: 0.0%
  Saturation Difference: 0.0%

Contrast Ratio: 1.06:1
WCAG Grade: Fail

发展

运行测试

# Run all tests
go test ./...

# Run tests with coverage
go test -cover ./...

# Run tests with race detection
go test -race ./...

# Run benchmarks
go test -bench=. ./...

建筑

# Build for current platform
go build

# Build for multiple platforms
GOOS=linux GOARCH=amd64 go build -o color-mcp-linux-amd64
GOOS=darwin GOARCH=amd64 go build -o color-mcp-darwin-amd64
GOOS=darwin GOARCH=arm64 go build -o color-mcp-darwin-arm64
GOOS=windows GOARCH=amd64 go build -o color-mcp-windows-amd64.exe

项目结构

color-mcp/
├── internal/
│   ├── types.go       # Color format detection and parsing
│   ├── convert.go     # Color conversion algorithms
│   ├── converter.go   # Main conversion logic and formatting
│   ├── compare.go     # Color comparison and contrast calculation
│   ├── constants.go   # Color space constants and thresholds
│   ├── value_objects.go   # Channel value types
│   └── *_test.go      # Comprehensive tests
├── main.go            # MCP server implementation
├── go.mod
├── go.sum
└── README.md

颜色转换算法

转换器使用OKLCH作为最高质量转换的中间格式:

  1. 输入检测:解析并检测输入格式
  2. RGB转换:将输入格式转换为RGB
  3. 目标转化:将RGB转换为目标格式
  4. 格式化:根据目标规范格式化输出

特殊处理:

  • OKLCH:使用适当的CIE XYZ中间体以获得感知精度
  • 实验室/XYZ:标准CIE颜色空间转换
  • CMYK:应用正确的黑键生成
  • 阿尔法:根据参数保留或剥离

贡献

欢迎投稿!拜托:

  1. 分叉存储库
  2. 创建要素分支
  3. 添加新功能的测试
  4. 确保所有测试通过
  5. 提交拉取请求

许可证

MIT许可证-有关详细信息,请参阅许可证文件

作者

由Inky(@Inky)创建

致谢

  • 基于CSS颜色模块4级的颜色空间转换公式
  • 基于Björn Ottosson工作的OKLCH实施
  • Anthropic的MCP协议规范

目录标签

目录标签

GoClaude设计颜色转换本地部署色彩空间网页设计工具无障碍设计色彩分析

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

4

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP