{"id":20461358,"url":"https://github.com/antvis/smart-color","last_synced_at":"2025-10-12T08:35:48.528Z","repository":{"id":47085553,"uuid":"378892710","full_name":"antvis/smart-color","owner":"antvis","description":"A JavaScript library for color computation.","archived":false,"fork":false,"pushed_at":"2023-09-28T03:28:08.000Z","size":5275,"stargazers_count":30,"open_issues_count":1,"forks_count":3,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-09-15T18:41:26.852Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://antv.vision/smart-color/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antvis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-06-21T10:28:28.000Z","updated_at":"2025-07-02T13:06:29.000Z","dependencies_parsed_at":"2023-11-08T06:50:57.714Z","dependency_job_id":"ab310f39-1f8b-425c-b476-345f545f5bd1","html_url":"https://github.com/antvis/smart-color","commit_stats":{"total_commits":74,"total_committers":4,"mean_commits":18.5,"dds":0.527027027027027,"last_synced_commit":"06b897dd773bf57b6e3cafaafc35e8fed6704f67"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/antvis/smart-color","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antvis%2Fsmart-color","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antvis%2Fsmart-color/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antvis%2Fsmart-color/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antvis%2Fsmart-color/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antvis","download_url":"https://codeload.github.com/antvis/smart-color/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antvis%2Fsmart-color/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010792,"owners_count":26084807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T12:24:58.870Z","updated_at":"2025-10-12T08:35:48.494Z","avatar_url":"https://github.com/antvis.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n\u003cb\u003e@antv/smart-color\u003c/b\u003e\n\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\nA JavaScript library for color computation.\n\u003c/div\u003e\n\n## ✨ Features\n\n* **Palette Generation**: Generate categorical or discrete scale palette based on [color scheme](https://github.com/neoddish/color-palette-json-schema#colorschemetype).\n* **Palette Optimization**: Optimize palette to enhance color discriminability.\n* **Palette Extraction**: Get palettes from strings and images.\n* **Color Simulation**: Simulate color blindness and color in grayscale.\n* **Color Evaluation**: Evaluate color discriminability and aesthetics.\n* **Color Computation**: Blend colors, brighten or darken colors.\n* **Color Conversion**: Convert color into different formats.\n\n## 📦 Installation\n\n```bash\n$ npm install @antv/smart-color\n```\n\n## 🔨 Getting Started\n\n* Palette Generation\n\n```ts\nimport { paletteGeneration } from '@antv/smart-color';\n\npaletteGeneration(\"monochromatic\", {\n  color: {\n    model: \"rgb\",\n    value: { r: 91, g: 143, b: 249 },\n  },\n  count: 7,\n  tendency: \"shade\"\n});\n```\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://gw.alipayobjects.com/zos/antfincdn/vmwgZKfSZB/jieping2021-07-01%252520xiawu3.01.26.png\" alt=\"auto generated palette\"\u003e\n\u003c/div\u003e\n\n* Palette Optimization\n\n```ts\nimport { PaletteOptimization } from '@antv/smart-color';\n\nconst palette = {\n  name: \"color4\",\n  semantic: null,\n  type: \"categorical\",\n  colors: [\n    { model: \"rgb\", value: { r: 101, g: 120, b: 155 }, },\n    { model: \"rgb\", value: { r: 91, g: 143, b: 249 }, },\n    { model: \"rgb\", value: { r: 97, g: 221, b: 170 }, },\n    { model: \"rgb\", value: { r: 246, g: 189, b: 22 }, }\n  ],\n}\npaletteOptimization(palette, {\n  locked: [true],\n  simulationType: \"grayscale\"\n});\n```\n\n\u003cdiv align=\"center\"\u003e\n  \u003cdiv\u003e\n    \u003cspan\u003eBefore:\u003c/span\u003e\n    \u003cimg src=\"https://gw.alipayobjects.com/zos/antfincdn/jT0dtYywS8/jieping2021-07-01%252520xiawu3.24.42.png\" alt=\"palette before optimization\"\u003e\n  \u003c/div\u003e\n  \u003cdiv\u003e\n    After:\n    \u003cimg src=\"https://gw.alipayobjects.com/zos/antfincdn/HCdz8Z8kr%26/jieping2021-07-01%252520xiawu3.24.29.png\" alt=\"palette after optimization\" \u003e\n  \u003c/div\u003e\n\u003c/div\u003e\n\n* Color Simulation\n\n```ts\nimport { colorSimulation } from '@antv/smart-color';\n\nconst color = {\n  model: \"rgb\",\n  value: { r: 91, g: 143, b: 249 },\n}\ncolorSimulation(color, \"achromatomaly\");\n```\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg height=100 src=\"https://gw.alipayobjects.com/zos/antfincdn/fxjnaPrLZ6/jieping2021-07-01%252520xiawu3.11.52.png\" alt=\"color simulation result\"\u003e\n\u003c/div\u003e\n\n## 🔗 Links\n\n* [API Reference](./docs/api/readme.md)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantvis%2Fsmart-color","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantvis%2Fsmart-color","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantvis%2Fsmart-color/lists"}