{"id":1478,"url":"https://github.com/jathu/UIImageColors","last_synced_at":"2025-08-06T13:33:02.090Z","repository":{"id":38361495,"uuid":"37709600","full_name":"jathu/UIImageColors","owner":"jathu","description":"Fetches the most dominant and prominent colors from an image.","archived":true,"fork":false,"pushed_at":"2021-12-14T14:24:39.000Z","size":52077,"stargazers_count":3247,"open_issues_count":0,"forks_count":242,"subscribers_count":43,"default_branch":"master","last_synced_at":"2024-11-29T21:45:34.546Z","etag":null,"topics":["ios","itunes","uicolor","uiimage"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":false,"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/jathu.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":"2015-06-19T08:00:52.000Z","updated_at":"2024-11-22T10:52:30.000Z","dependencies_parsed_at":"2022-08-09T03:15:28.665Z","dependency_job_id":null,"html_url":"https://github.com/jathu/UIImageColors","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jathu%2FUIImageColors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jathu%2FUIImageColors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jathu%2FUIImageColors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jathu%2FUIImageColors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jathu","download_url":"https://codeload.github.com/jathu/UIImageColors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228905520,"owners_count":17989779,"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":["ios","itunes","uicolor","uiimage"],"created_at":"2024-01-05T20:15:47.391Z","updated_at":"2024-12-09T14:31:09.413Z","avatar_url":"https://github.com/jathu.png","language":"Swift","funding_links":[],"categories":["Media","Libs","Swift","UI","Images [🔝](#readme)"],"sub_categories":["Image","Images","Other free courses"],"readme":"![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg)\n![platform: iOS, tvOS and macOS](https://img.shields.io/badge/platform-iOS%20%7C%20tvOS%20%7C%20macOS-lightgrey.svg)\n\n# UIImageColors\n\niTunes style color fetcher for `UIImage` and `NSImage`. It fetches the most dominant and prominent colors.\n\n![preview](preview.png)\n\n## Installation\n\n### Manual\n\nCopy [UIImageColors.swift](UIImageColors/Sources/UIImageColors.swift) into your project.\n\n### [Cocoapods](https://cocoapods.org)\n\nAdd UIImageColors to your [`Podfile`](https://cocoapods.org/pods/UIImageColors):\n\n```\npod 'UIImageColors'\n```\n\n### [Carthage](https://github.com/Carthage/Carthage)\n\nAdd UIImageColors to your `Cartfile`:\n\n```\ngithub \"jathu/UIImageColors\"\n```\n\n## Example\n\nAsynchronous example:\n\n```swift\nlet image = UIImage(named: \"yeezus.png\")\n\nimage.getColors { colors in\n  backgroundView.backgroundColor = colors.background\n  mainLabel.textColor = colors.primary\n  secondaryLabel.textColor = colors.secondary\n  detailLabel.textColor = colors.detail\n}\n```\n\nSynchronous example:\n\n```swift\nlet colors = UIImage(named: \"yeezus.png\").getColors()\n\nbackgroundView.backgroundColor = colors.background\nmainLabel.textColor = colors.primary\nsecondaryLabel.textColor = colors.secondary\ndetailLabel.textColor = colors.detail\n```\n\n## Image Methods\n\n```swift\ngetColors() -\u003e UIImageColors?\ngetColors(quality: ImageColorsQuality) -\u003e UIImageColors?\ngetColors(_ completion: (UIImageColors?) -\u003e Void) -\u003e Void\ngetColors(quality: UIImageColorsQuality, _ completion: (UIImageColors?) -\u003e Void) -\u003e Void\n```\n\n## UIImageColors Objects\n\n`UIImageColors` is struct that contains four different `UIColor` (or `NSColor` on macOS) variables.\n\n```swift\npublic struct UIImageColors {\n    public var background: UIColor!\n    public var primary: UIColor!\n    public var secondary: UIColor!\n    public var detail: UIColor!\n}\n```\n\n`UIImageColorsQuality` is a enum with four different qualities. The qualities refer to how much the original image is scaled down. `Lowest` implies smaller size and faster performance at the cost of quality colors. `High` implies larger size with slower performance with good colors. `Highest` implies no downscaling and very good colors, but it is very slow.\n\nThe default is set to `high`.\n\n```swift\npublic enum UIImageColorsQuality: CGFloat {\n    case lowest = 50 // 50px\n    case low = 100 // 100px\n    case high = 250 // 250px\n    case highest = 0 // No scale\n}\n```\n\n## License\n\nThe [license](https://github.com/jathu/UIImageColors/blob/master/LICENSE) is provided in the project folder. This is based on Panic's [OS X ColorArt](https://github.com/panicinc/ColorArt/#license).\n\n------\nJune 2015 - Toronto\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjathu%2FUIImageColors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjathu%2FUIImageColors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjathu%2FUIImageColors/lists"}