ข้ามไปยังเนื้อหา

โอเพ่น API

เอนด์พอยต์ฟรี 5 รายการ ไม่ต้องลงทะเบียน ไม่ต้องใช้กุญแจ เปิดใช้งาน CORS ข้อมูลเดียวกับเว็บไซต์: พื้นที่ 24 บิต สีที่ตั้งชื่อแล้ว 32,258 สี ตัวอย่างสีมาตรฐาน 17,756 สี และสีแบบดั้งเดิมของจีน 659 สี

เอนด์พอยต์ในภาพรวม

ทุกเอนด์พอยต์เปิดใช้งาน CORS - ดึงข้อมูลได้โดยตรงจากเบราว์เซอร์หรือ Node.js

GET/api/color/e63946

โปรไฟล์สี: 10 รูปแบบ + สีที่มีชื่อใกล้เคียง + การจับคู่ใน 8 ระบบมาตรฐาน + การจับคู่สีดั้งเดิม + 6 ความสอดคล้องกัน + คอนทราสต์

พารามิเตอร์

hexค่าสี: เลขฐานสิบหก 3 หรือ 6 หลัก (e63946 หรือ e63)

ตัวอย่างคำขอ

curl "https://www.yanseku.com/api/color/e63946"

ตัวอย่างการตอบสนอง

{
  "hex": "e63946",
  "formats": {
    "rgb": { "r": 230, "g": 57, "b": 70 },
    "hsl": { "h": 355.5, "s": 77.6, "l": 56.3 },
    "hsv": { "h": 355.5, "s": 75.2, "v": 90.2 },
    "cmyk": { "c": 0, "m": 75.2, "y": 69.6, "k": 9.8 },
    "xyz": { "x": 0.352, "y": 0.2019, "z": 0.0784 },
    "lab": { "L": 52.06, "a": 65.72, "b": 34.14 },
    "oklch": { "L": 0.612, "c": 0.208, "h": 22.2 },
    "webSafe": "ff3333",
    "css": { "rgb": "rgb(230, 57, 70)", "hsl": "hsl(355.5, 77.6%, 56.3%)" }
  },
  "named": {
    "closest": { "name": "Paint the Town Red", "hex": "e63045", "deltaE": 1.34, "exact": false },
    "nearest": [ { "name": "Red Radish", "hex": "ee3344", "deltaE": 1.36, "exact": false } ]
  },
  "standards": [
    { "system": "ncs", "systemName": "NCS (Natural Color System)", "code": "NCS S 0570-Y90R", "name": "NCS S 0570-Y90R", "hex": "e6373f", "deltaE": 1.69, "exact": false },
    { "system": "munsell", "systemName": "Munsell (Re-renotation)", "code": "7.5R 6/16", "name": "7.5R 6/16", "hex": "dd3743", "deltaE": 2.02, "exact": false }
  ],
  "traditional": [
    { "name": "火红", "hex": "ff2d51", "cat": "红", "deltaE": 4.88, "exact": false },
    { "name": "银红", "hex": "f05654", "cat": "红", "deltaE": 5.89, "exact": false }
  ],
  "harmony": [
    { "type": "complementary", "colors": ["e63946", "39e6d9"] },
    { "type": "split-complementary", "colors": ["e63946", "39e683", "399de6"] }
  ],
  "contrast": {
    "onWhite": { "ratio": 4.17, "levels": { "aaNormal": false, "aaLarge": true, "aaaNormal": false, "aaaLarge": false } },
    "onBlack": { "ratio": 5.04, "levels": { "aaNormal": true, "aaLarge": true, "aaaNormal": false, "aaaLarge": true } },
    "bestText": "#000000"
  }
}

GET/api/scheme?hex=e63946&mode=triadic

โครงร่างความสอดคล้องกัน: 6 กฎรอบสีฐานของคุณ

พารามิเตอร์

hexค่าสี: เลขฐานสิบหก 3 หรือ 6 หลัก (e63946 หรือ e63)
modeโหมดความสอดคล้องกัน ค่าเริ่มต้นคือ complementary ตัวเลือก: complementary / split-complementary / triadic / tetradic / analogous / monochromatic

ตัวอย่างคำขอ

curl "https://www.yanseku.com/api/scheme?hex=e63946&mode=triadic"

ตัวอย่างการตอบสนอง

{
  "hex": "e63946",
  "mode": "triadic",
  "count": 3,
  "colors": ["e63946", "46e639", "3946e6"]
}

GET/api/contrast?fg=ffffff&bg=e63946

การตรวจสอบคอนทราสต์: อัตราส่วน WCAG + ระดับ AA/AAA + สีข้อความที่ดีที่สุด

พารามิเตอร์

fgForeground hex, ตัวอย่าง ffffff
bgBackground hex, ตัวอย่าง e63946

ตัวอย่างคำขอ

curl "https://www.yanseku.com/api/contrast?fg=ffffff&bg=e63946"

ตัวอย่างการตอบสนอง

{
  "fg": "ffffff",
  "bg": "e63946",
  "ratio": 4.17,
  "label": "AA Large",
  "levels": { "aaNormal": false, "aaLarge": true, "aaaNormal": false, "aaaLarge": false },
  "bestText": "#000000"
}

GET/api/random?count=5

สีสุ่มจากกลุ่มชื่อที่คัดสรรแล้ว สูงสุด 10 สี

พารามิเตอร์

countจำนวนสี 1-10, ค่าเริ่มต้น 1

ตัวอย่างคำขอ

curl "https://www.yanseku.com/api/random?count=5"

ตัวอย่างการตอบสนอง

{
  "count": 3,
  "colors": [
    { "name": "Sea Foam Green", "hex": "c2e4d0" },
    { "name": "Deep Koamaru", "hex": "333366" },
    { "name": "Laser Lemon", "hex": "ffff66" }
  ]
}

ดาวน์โหลดข้อมูลแบบเปิด

นอกเหนือจาก API - นำ color库 ทั้งหมดไปใช้กับคุณได้ รูปแบบ CSV (UTF-8, แถวส่วนหัว) พร้อมสำหรับการวิเคราะห์ข้อมูล, การเรียนรู้ของเครื่อง และการวิจัยระบบดีไซน์ ชื่อฟิลด์อยู่ในส่วนหัว; ชุดข้อมูลจะอัปเดตทุกครั้งที่มีการ build ใหม่

ชื่อสีมาจาก meodai/color-names (MIT) และ xkcd Color Survey; สีแบรนด์จากข้อมูลโอเพ่นของ simple-icons; สีแบบดั้งเดิมของจีนจาก zerosoul/chinese-colors และ zhongguose.com; ค่าสีตัวอย่างมาตรฐานคือการแปลงแบบจำลองด้วยคอมพิวเตอร์ - ตรวจสอบกับตัวอย่างสีจริงก่อนใช้ในงานผลิต ปฏิบัติตามใบอนุญาตของแหล่งข้อมูลต้นทางที่เกี่ยวข้อง

แพ็กเกจโอเพ่นซอร์ส

เอ็นจิ้นและข้อมูลของเว็บไซต์เผยแพร่เป็นไลบรารีโอเพ่นซอร์ส - ใช้งานออฟไลน์ได้ พร้อมใช้ในงานผลิต แพ็กเกจ npm 3 ตัวครอบคลุมเอ็นจิ้น ชุดข้อมูล และ MCP Server รวมถึงพอร์ต Python และชุดข้อมูล HuggingFace

@yanseku/color

Color engine: การแปลง 10 รูปแบบ, CIEDE2000, APCA, OKLab blending, กฎความสอดคล้อง 6 ข้อ, การจำลองการมองเห็น - คณิตศาสตร์ล้วน, ไม่มี dependencies

npm install @yanseku/color
@yanseku/data

ชุดข้อมูล: 17 คอร์ปัส, มากกว่า 85,000 รายการ (สีตั้งชื่อ, ตัวอย่างสีมาตรฐาน, สีดั้งเดิม, สีญี่ปุ่น, สีแบรนด์...), JSON ที่มี LAB ที่คำนวณไว้ล่วงหน้า

npm install @yanseku/data
@yanseku/mcp

MCP Server: เชื่อมต่อ color database ทั้งหมดเข้ากับ Claude / Cursor - เครื่องมือออฟไลน์ 7 ตัว

npm install -g @yanseku/mcp
yanseku (Python)

พอร์ต Python: ติดตั้งด้วย pip และใช้งานได้ - ใช้คณิตศาสตร์ D65 และ deltaE2000 เหมือนกัน, มีเรื่องราวดั้งเดิม 659 เรื่องรวมอยู่ด้วย

pip install yanseku

การตั้งค่า MCP (claude_desktop_config.json)

{
  "mcpServers": {
    "yanseku": {
      "url": "https://www.yanseku.com/api/mcp"
    }
  }
}

การตั้งค่า MCP - แบบท้องถิ่น (npx, ออฟไลน์)

{
  "mcpServers": {
    "yanseku": {
      "command": "npx",
      "args": ["-y", "@yanseku/mcp"]
    }
  }
}

การเปรียบเทียบความสามารถกับไลบรารีสีอื่นๆ

ไลบรารีทั่วไปทำเฉพาะการคำนวณเท่านั้น ชั้นพิเศษของ Yanseku คือข้อมูล: การค้นหาสีตามชื่อ การจับคู่สีตัวอย่างอย่างเป็นทางการ และเรื่องราวสีดั้งเดิม

ความสามารถYansekucolorjs.ioculorichroma-js
การแปลงช่องว่างสี (10 รูปแบบ)✔✔✔
ความแตกต่างของสี CIEDE2000✔✔✔
ความคอนทราสต์การรับรู้ APCA✔✘✘
การจำลองการมองเห็นสี (8 ประเภท)✔✘✘
การค้นหาสีตามชื่อ (32,258)✔ 32,258✘✘
การจับคู่สีตัวอย่างอย่างเป็นทางการ (12 ระบบ)✔ 17,756✘✘
เรื่องราวสีดั้งเดิมของจีน (659)✔ 659✘✘
กฎความสอดคล้องทางการรับรู้✔ 6 rules✘✔ palette
MCP Server (ออฟไลน์)✔ remote + offline✘✘
พอร์ต Python✔✘✘
ชุดข้อมูล CSV / HF เต็มรูปแบบ✔ 17 sets✘✘

แหล่งดาวน์โหลด: npm (@yanseku/color · @yanseku/data · @yanseku/mcp) · PyPI (yanseku) · HuggingFace (yanseku/chinese-traditional-colors)

ที่มา: standard = ตัวอย่างสีอย่างเป็นทางการ; community = สีที่ตั้งชื่อโดยชุมชน; traditional = สีแบบดั้งเดิมของจีน

เอนด์พอยต์สาธารณะฟรี - โปรดใช้อย่างสมเหตุสมผล (แนะนำ ≤ 60 ครั้ง/นาที)