{"id":17988545,"url":"https://github.com/heyvito/colorarty","last_synced_at":"2025-07-20T08:33:35.393Z","repository":{"id":57514048,"uuid":"71936075","full_name":"heyvito/colorarty","owner":"heyvito","description":"🎨 Extracts predominant colors from a given image","archived":false,"fork":false,"pushed_at":"2017-09-08T01:56:20.000Z","size":6,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-06T14:06:32.867Z","etag":null,"topics":["color","golang-library","golang-package","image-processing","predominant-color"],"latest_commit_sha":null,"homepage":"","language":"Go","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/heyvito.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}},"created_at":"2016-10-25T20:27:08.000Z","updated_at":"2019-03-12T05:34:25.000Z","dependencies_parsed_at":"2022-08-31T23:00:57.805Z","dependency_job_id":null,"html_url":"https://github.com/heyvito/colorarty","commit_stats":null,"previous_names":["victorgama/colorarty"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/heyvito/colorarty","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyvito%2Fcolorarty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyvito%2Fcolorarty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyvito%2Fcolorarty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyvito%2Fcolorarty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heyvito","download_url":"https://codeload.github.com/heyvito/colorarty/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyvito%2Fcolorarty/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266092799,"owners_count":23875544,"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","golang-library","golang-package","image-processing","predominant-color"],"created_at":"2024-10-29T19:11:59.179Z","updated_at":"2025-07-20T08:33:35.367Z","avatar_url":"https://github.com/heyvito.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# colorarty\n[![Go Report Card](https://goreportcard.com/badge/github.com/victorgama/colorarty)](https://goreportcard.com/report/github.com/victorgama/colorarty)\n[![GoDoc](https://godoc.org/github.com/victorgama/go-unfurl?status.svg)](https://godoc.org/github.com/victorgama/go-unfurl)\n\n**colorarty** is a small library that analyses images and extracts a background, primary, secondary and detail colors, all suitable for reading.\n\nHere's a simple example that converts extracted colors into CSS declarations:\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"image\"\n\t\"image/color\"\n\t_ \"image/jpeg\"\n\t\"os\"\n\n\t\"github.com/victorgama/colorarty\"\n)\n\nfunc main() {\n\treader, _ := os.Open(\"/Users/victorgama/Downloads/sample.jpeg\")\n\timg, _, _ := image.Decode(reader)\n\tresult := colorarty.Analyse(img)\n\tfmt.Printf(\"#background { background: %s }\\n\", toCSS(*result.BackgroundColor))\n\tfmt.Printf(\".primary { color: %s }\\n\", toCSS(*result.PrimaryColor))\n\tfmt.Printf(\".secondary { color: %s }\\n\", toCSS(*result.SecondaryColor))\n\tfmt.Printf(\".detail { color: %s }\\n\", toCSS(*result.DetailColor))\n}\n\nfunc toCSS(c color.Color) string {\n\tcr, cg, cb, _ := c.RGBA()\n\tr := float64(cr)\n\tg := float64(cg)\n\tb := float64(cb)\n\tr /= 0x101\n\tg /= 0x101\n\tb /= 0x101\n\treturn fmt.Sprintf(\"rgba(%.0f, %.0f, %.0f, 1)\", r, g, b)\n}\n\n```\n\nThe generated CSS was used to build this next example:\n\n![example](https://i.imgur.com/LroDbI4.png)\n\n## Installing\n1. Download and install it:\n```\n$ go get -u github.com/victorgama/colorarty\n```\n2. Import it in your code:\n```go\nimport \"github.com/victorgama/colorarty\"\n```\n\n## License\n\n**colorarty** was inspired by [this](https://panic.com/blog/itunes-11-and-colors/) post and [this](https://github.com/panicinc/ColorArt) project, both from Panic, Inc. 💖🦄\n\n```\nMIT License\n\nCopyright (c) 2016 Victor Gama\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyvito%2Fcolorarty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheyvito%2Fcolorarty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyvito%2Fcolorarty/lists"}