{"id":22001662,"url":"https://github.com/waterbeside/colorsea","last_synced_at":"2025-05-01T10:13:39.257Z","repository":{"id":65453158,"uuid":"577649114","full_name":"waterbeside/colorsea","owner":"waterbeside","description":"A color tool library written in Typescript, you can use it for color space conversion, color manipulation, and color difference query. Support X11, Chinese traditional color, Nippon color color name query. 一个使用Typescript编写的颜色工具库，你可以使用此进行颜色空间的转换、颜色操作、以及色差查询。支持X11、中国传统色、Nippon color颜色名查询","archived":false,"fork":false,"pushed_at":"2024-06-22T10:41:32.000Z","size":1416,"stargazers_count":17,"open_issues_count":3,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-20T01:33:05.906Z","etag":null,"topics":["chinese-color","color","colorconverter","deltae","hex","hsl","lab","nipponcolor","rgb","typescript","x11"],"latest_commit_sha":null,"homepage":"https://colorsea.js.org","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/waterbeside.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-13T08:01:42.000Z","updated_at":"2025-04-03T22:05:19.000Z","dependencies_parsed_at":"2024-10-30T04:53:53.071Z","dependency_job_id":null,"html_url":"https://github.com/waterbeside/colorsea","commit_stats":{"total_commits":150,"total_committers":1,"mean_commits":150.0,"dds":0.0,"last_synced_commit":"5ae45b6c45f31d7db09c80cbace969e563a26131"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waterbeside%2Fcolorsea","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waterbeside%2Fcolorsea/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waterbeside%2Fcolorsea/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waterbeside%2Fcolorsea/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waterbeside","download_url":"https://codeload.github.com/waterbeside/colorsea/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251800761,"owners_count":21645964,"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","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":["chinese-color","color","colorconverter","deltae","hex","hsl","lab","nipponcolor","rgb","typescript","x11"],"created_at":"2024-11-29T23:14:36.644Z","updated_at":"2025-05-01T10:13:39.237Z","avatar_url":"https://github.com/waterbeside.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# COLORSEA\n\n[For detailed documents, please click here](https://colorsea.js.org)\n\n![minzipped size](https://img.shields.io/bundlephobia/minzip/colorsea)\n![typescript](https://img.shields.io/github/languages/top/waterbeside/colorsea)\n![license](https://img.shields.io/npm/l/colorsea)\n![last commit](https://img.shields.io/github/last-commit/waterbeside/colorsea)\n![build](https://img.shields.io/github/actions/workflow/status/waterbeside/colorsea/build.yml)\n\n[English](./README.md) | [简体中文](./README.zh-CN.md)\n\n## About\n\n**colorsea.js** is a tiny color tool library written in `Typescript`.\n\n- You can use it to convert color spaces (`RGB`, `HSL`, `HSV`, `HSI`, `HWB`, `XYZ`, `LAB`, `LCH`, `xyY`),\n- Adjust the color like LESS/SASS, such as `darken`/`lighten`, `saturate`/`desaturate`, `spin`, `fadeIn`/`fadeOut`, `mix` and other methods, easy to use.\n- Support `CMC(l:c)`, `CIE2000`, `CIE1994`, `CIE1976` color difference queries.\n- Support to use `X11`, `Chinese Traditional Color`, `Japanese Traditional Color` types of color names to get the color\n\n## Quick Start\n\n### Installation\n\n```bash\nnpm install colorsea \n```\n\n### Import \u0026 Use\n\n#### Import\n\nES Module\n\n```typescript\nimport colorsea from 'colorsea'\n```\n\nCommonJs\n\n```javascript\nconst colorsea = require('colorsea')\n```\n\nBrowser\n\n```html:no-line-numbers\n\u003cscript src=\"path/to/colorsea.js\"\u003e\u003c/script\u003e\n```\n\n#### Color space conversion\n\n```typescript\n// ----- color conversion\ncolorsea('#ff0000').rgb() // [255, 0, 0]\ncolorsea('#ff0000', 50).rgba() // [255, 0, 0, 50]\n// The colorsea() function can create a Color instance\nconst color = colorsea('#405060')\ncolor.rgba() // [255, 0, 0, 50]\ncolor.xyz() // [7.09, 7.67, 12.17]\ncolor.lab() // [33.29, -1.94, -11.36] \n// Convert from other color spaces\ncolorsea.xyz(7.09, 7.67, 12.17).rgb() // [64, 80, 96]\ncolorsea.hsl(210, 20, 31.37).rgb() // [64, 80, 96]\n// ... Other color spaces are similar\n```\n\n#### Color operations\n\n```typescript\n// ---- Color operations\nconst color = colorsea('#ffffff')\nconst newColor = color.darken(10) // All operations will return a new Color instance object\nnewColor.hex() // #e6e6e6\ncolorsea('#000').lighten(10).hex() // #1a1a1a\ncolorsea('#ff0000').spin(180).hex() // #00ffff\ncolorsea.hsl(80, 90, 20).saturate(10).hsl() // [80, 100, 20]\ncolorsea.hsl(80, 90, 20).desaturate(10).hsl() // [80, 80, 20]\ncolorsea('#776600').fadeOut(10).rgba() // [119, 102, 0, 90]\n\nconst color1 = new Color('#ff0000')\nconst color2 = new Color('#0000ff')\nconst color = color1.mix(color2, 20)\ncolor.hex() // #cc0033\n```\n\n#### Color difference calculation\n\n```typescript\nconst color1 = colorsea.lab(80, 30, 120) // Standard color (reference color)\nconst color2 = colorsea.lab(79, 28, 100) // Sample color\n\n// CMC(1:1)\ncolor1.deltaE(color2, 'CMC') // 5.754...\n\n// CMC(2:1) formula, just set the weight factor l to 2 (c defaults to 1)\ncolor1.deltaE(color2, 'CMC', { l: 2 }) // 5.719...\n\n// CIE2000\ncolor1.deltaE(color2, 'CIE2000') // 3.6815...\n\n// CIE1994\ncolor1.deltaE(color2, 'CIE1994') // 3.3725...\n\n// CIE1976\ncolor1.deltaE(color2, 'CIE1976') // 20.1246...\n\n```\n\n### Use color names\n\n```typescript\nimport colorsea from 'colorsea'\nimport x11 from 'colorsea/colors/x11'\n// Load X11 color names\ncolorsea.useNames(x11)\n\n// At this point you can directly use the X11 color name to create the color instance\ncolorsea('Aqua') // color: #00ffff\ncolorsea('Aquamarine') // color: #7fffd4\n```\n\n```typescript\nimport chinese from 'colorsea/colors/chinese' // Chinese traditional color\nimport nippon from 'colorsea/colors/nippon' // Japanese traditional color\n// load both\ncolorsea.useNames(chinese).useNames(nippon)\n\n// use\ncolorsea('山梗紫') // color: #61649F\ncolorsea('水がき') // color: #B9887D\n```\n\nFor more detailed usage, please refer to the documentation: [https://colorsea.js.org](https://colorsea.js.org/)\n\n## Reference\n\n- [ https://github.com/sass/dart-sass/](https://github.com/sass/dart-sass/)\n- [http://brucelindbloom.com/](http://brucelindbloom.com/)\n- [https://www.w3.org/TR/AERT/#color-contrast](https://www.w3.org/TR/AERT/#color-contrast)\n- [https://www.w3.org/TR/AERT/#color-contrast](https://www.w3.org/TR/AERT/#color-contrast)\n- [x11: https://www.w3.org/TR/css-color-3/#svg-color](https://www.w3.org/TR/css-color-3/#svg-color)\n- [中国传统色: http://zhongguose.com/](http://zhongguose.com/)\n- [Nippon color names: https://nipponcolors.com/](https://nipponcolors.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaterbeside%2Fcolorsea","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaterbeside%2Fcolorsea","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaterbeside%2Fcolorsea/lists"}