{"id":16743691,"url":"https://github.com/jiatln/color-art","last_synced_at":"2025-03-21T22:31:39.136Z","repository":{"id":114239807,"uuid":"577773321","full_name":"JiatLn/color-art","owner":"JiatLn","description":"A rust crate for working with colors and color spaces.","archived":false,"fork":false,"pushed_at":"2025-02-12T08:59:11.000Z","size":287,"stargazers_count":18,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T05:35:06.992Z","etag":null,"topics":["color","color-art","colors","colorspaces","rust","rust-library"],"latest_commit_sha":null,"homepage":"https://color-art.netlify.app","language":"Rust","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/JiatLn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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-13T13:48:17.000Z","updated_at":"2025-02-12T09:28:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"6cc1f2ef-d532-40b8-907e-5d0806fe7de8","html_url":"https://github.com/JiatLn/color-art","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiatLn%2Fcolor-art","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiatLn%2Fcolor-art/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiatLn%2Fcolor-art/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JiatLn%2Fcolor-art/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JiatLn","download_url":"https://codeload.github.com/JiatLn/color-art/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244880263,"owners_count":20525505,"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":["color","color-art","colors","colorspaces","rust","rust-library"],"created_at":"2024-10-13T01:27:47.648Z","updated_at":"2025-03-21T22:31:38.822Z","avatar_url":"https://github.com/JiatLn.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"./graphs/logo.png\" alt=\"ColorArt - A rust crate for working with colors and color spaces.\" width=\"120\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003eColor Art\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\nA rust crate for working with colors and color spaces.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/JiatLn/color-art\" target=\"_blank\"\u003e\n    \u003cimg alt=\"github\" src=\"https://img.shields.io/badge/github-JiatLn/color_art-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github\" height=\"20\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://crates.io/crates/color-art\" target=\"_blank\"\u003e\n    \u003cimg alt=\"crates.io\" src=\"https://img.shields.io/crates/v/color_art.svg?style=for-the-badge\u0026color=fc8d62\u0026logo=rust\" height=\"20\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://docs.rs/color_art\" target=\"_blank\"\u003e\n    \u003cimg alt=\"docs.rs\" src=\"https://img.shields.io/badge/docs.rs-color_art-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logo=docs.rs\" height=\"20\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n## Documentation\n\nSee [Color Art](https://color-art.netlify.app).\n\n\n## Usage\n\n### Add Dependency\n\n```toml\n[dependencies]\ncolor-art = \"0.3\"\n```\n\n### Color generator\n\n#### Create color from string\n\nYou can use the `from_str` method to construct a color from a string. \n\n\u003cdetails\u003e\n\u003csummary\u003eCurrently supported color formats\u003c/summary\u003e\n\u003cbr\u003e\n\u003cul\u003e\n  \u003cli\u003e\u003ccode\u003ergb\u003c/code\u003e / \u003ccode\u003ergba\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003ehex\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003ehsl\u003c/code\u003e / \u003ccode\u003ehsla\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003ehsv\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003ehsi\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003ehwb\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003ecmyk\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003exyz\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003eyiq\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003eyuv\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003eYCbCr\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003elab\u003c/code\u003e\u003c/li\u003e\n  \u003cli\u003e\u003ccode\u003enamed color\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eFor example\u003c/summary\u003e\n\u003cbr\u003e\n\n```rust\nuse color_art::Color;\nuse std::str::FromStr;\n\nlet color = Color::from_str(\"rgb(255, 255, 0)\").unwrap();\nlet color = Color::from_str(\"rgba(255, 255, 0, 0.5)\").unwrap();\nlet color = Color::from_str(\"#ffff00\").unwrap();\nlet color = Color::from_str(\"hsl(60, 100%, 50%)\").unwrap();\nlet color = Color::from_str(\"hsla(60, 100%, 50%, 0.6)\").unwrap();\nlet color = Color::from_str(\"hsv(60, 100%, 100%)\").unwrap();\nlet color = Color::from_str(\"hsi(60, 100%, 66.67%)\").unwrap();\nlet color = Color::from_str(\"hwb(60, 0%, 0%)\").unwrap();\nlet color = Color::from_str(\"cmyk(0%, 0%, 100%, 0%)\").unwrap();\nlet color = Color::from_str(\"xyz(0.769975, 0.927808, 0.138526)\").unwrap();\nlet color = Color::from_str(\"yiq(0.886, 0.32126, -0.31114)\").unwrap();\nlet color = Color::from_str(\"yuv(0.886, -0.4359, 0.1)\").unwrap();\nlet color = Color::from_str(\"YCbCr(225.93, 0.5755, 148.7269)\").unwrap();\nlet color = Color::from_str(\"lab(97.14, -21.55, 94.48)\").unwrap();\nlet color = Color::from_str(\"yellow\").unwrap();\n```\n\n\u003c/details\u003e\n\n#### Create color from number\n\nYou can use the `from_num` method to construct a color from a number.\n\nFor example:\n\n```rust\nuse color_art::Color;\n\nlet color = Color::from_num(16776960).unwrap();\nlet color = Color::from_num(0xffff00).unwrap();\n```\n\n#### Create color from name\n\nYou can use the `from_name` method to construct a color from a name.\n\nFor example:\n\n```rust\nuse color_art::Color;\n\nlet color = Color::from_name(\"yellow\").unwrap();\n```\n\n#### Create color from color space\n\nYou can use the `from_\u003ccolor_space\u003e` method to construct a color from a color space.\n\nCurrently supported color spaces:\n\n- `rgb` \n- `rgba`\n- `hsl`\n- `hsv`\n- `cmyk`\n- `hex`\n\nMore color spaces will be supported in the future.\n\nFor example:\n\n```rust\nuse color_art::Color;\n\nlet color = Color::from_rgb(255, 255, 0).unwrap();\nlet color = Color::from_rgba(255, 255, 0, 0.5).unwrap();\nlet color = Color::from_hsl(60.0, 1.0, 0.5).unwrap();\nlet color = Color::from_hsv(60.0, 1.0, 1.0).unwrap();\nlet color = Color::from_cmyk(0.0, 0.0, 1.0, 0.0).unwrap();\nlet color = Color::from_hex(\"#ffff00\").unwrap();\n```\n\nMore examples can be found in [Construct from color spaces](https://color-art.netlify.app/construct-a-color/from-space).\n\n#### Other color generator methods\n\n- [random](./docs/color_generator.md#random) - Generate a random color.\n- [mix](./docs/color_generator.md#mix) - Mix two colors.\n- [blend](./docs/color_generator.md#blend) - Blend two colors with a blending mode.\n- [average](./docs/color_generator.md#average) - Average a list of colors.\n\n### Color conversion\n\n#### Stringify a color\n\nStringify a color to a string.\n\n\u003e Refer to [Construct from string](https://color-art.netlify.app/construct-a-color/from-string.html).\n\n\u003c/details\u003e\n\n### Color Channels\n\nExtract the color channels.\n\n\u003e Refer to [Color Channels](https://color-art.netlify.app/api/channels.html).\n\n### Color Operations\n\nColor operation functions.\n\n\u003e Refer to [Color Operations](https://color-art.netlify.app/api/operations.html).\n\n---\n\n\nMade with ❤️ by [JiatLn](https://github.com/JiatLn).\n\n## License\n\n[MIT](./LICENSE) License © 2022-Present [JiatLn](https://github.com/JiatLn)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiatln%2Fcolor-art","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjiatln%2Fcolor-art","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiatln%2Fcolor-art/lists"}