{"id":17076894,"url":"https://github.com/zenangst/hue","last_synced_at":"2025-10-08T00:09:10.357Z","repository":{"id":3158971,"uuid":"48606375","full_name":"zenangst/Hue","owner":"zenangst","description":":art: Hue is the all-in-one coloring utility that you'll ever need.","archived":false,"fork":false,"pushed_at":"2023-09-15T12:30:19.000Z","size":2554,"stargazers_count":3513,"open_issues_count":2,"forks_count":224,"subscribers_count":51,"default_branch":"master","last_synced_at":"2025-10-08T00:03:18.014Z","etag":null,"topics":["color","gradient","hex","hue"],"latest_commit_sha":null,"homepage":"https://github.com/zenangst","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zenangst.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":"FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":["zenangst"]}},"created_at":"2015-12-26T09:51:51.000Z","updated_at":"2025-09-22T20:22:07.000Z","dependencies_parsed_at":"2022-08-25T20:40:54.693Z","dependency_job_id":"12e18aec-8001-4e89-abf2-f5f48a4935c1","html_url":"https://github.com/zenangst/Hue","commit_stats":{"total_commits":180,"total_committers":29,"mean_commits":6.206896551724138,"dds":0.7,"last_synced_commit":"d98d97d6bdd6904ab5cffa96ad6fc47f6233b510"},"previous_names":["hyperoslo/hue"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/zenangst/Hue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenangst%2FHue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenangst%2FHue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenangst%2FHue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenangst%2FHue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zenangst","download_url":"https://codeload.github.com/zenangst/Hue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zenangst%2FHue/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278866934,"owners_count":26059672,"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-07T02:00:06.786Z","response_time":59,"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":["color","gradient","hex","hue"],"created_at":"2024-10-14T12:10:20.881Z","updated_at":"2025-10-08T00:09:10.318Z","avatar_url":"https://github.com/zenangst.png","language":"Swift","funding_links":["https://github.com/sponsors/zenangst"],"categories":[],"sub_categories":[],"readme":"![Hue](https://github.com/hyperoslo/Hue/blob/master/Images/cover.png)\n\nHue is the all-in-one coloring utility that you'll ever need.\n\n[![Version](https://img.shields.io/cocoapods/v/Hue.svg?style=flat)](http://cocoadocs.org/docsets/Hue)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![License](https://img.shields.io/cocoapods/l/Hue.svg?style=flat)](http://cocoadocs.org/docsets/Hue)\n[![Platform](https://img.shields.io/cocoapods/p/Hue.svg?style=flat)](http://cocoadocs.org/docsets/Hue)\n![Swift](https://img.shields.io/badge/%20in-swift%205.0-orange.svg)\n\n## Usage\n\n#### Hex\n\u003cimg src=\"https://raw.githubusercontent.com/hyperoslo/Hue/master/Images/icon_v3.png\" alt=\"Hue Icon\" align=\"right\" /\u003eYou can easily use hex colors with the `init(hex:)` convenience initializer on `UIColor`. It supports the following hex formats `#ffffff`, `ffffff`, `#fff`, `fff`\n```swift\nlet white = UIColor(hex: \"#ffffff\")\nlet black = UIColor(hex: \"#000000\")\nlet red = UIColor(hex: \"#ff0000\")\nlet blue = UIColor(hex: \"#0000ff\")\nlet green = UIColor(hex: \"#00ff00\")\nlet yellow = UIColor(hex: \"#ffff00\")\n```\n\n#### Computed color properties\n```swift\nlet white = UIColor(hex: \"#ffffff\")\nlet black = UIColor(hex: \"#000000\")\n\nif white.isDarkColor {} // return false\nif white.isBlackOrWhite {} // return true\n```\n\n#### Alpha\n`.alpha` is a sugar for `colorWithAlphaComponent`, internally it does the exact same thing, think of it as a\nlipstick for your implementation.\n```swift\nlet colorWithAlpha = myColor.alpha(0.75)\n```\n\n#### Gradients\nYou can easily create gradient layers using the `gradient()` method on arrays with `UIColor`.\nAs an extra bonus, you can also add a transform closure if you want to modify the `CAGradientLayer`.\n\n```swift\nlet gradient = [UIColor.blackColor(), UIColor.orangeColor()].gradient()\n\nlet secondGradient = [UIColor.blackColor(), UIColor.orangeColor()].gradient { gradient in\n  gradient.locations = [0.25, 1.0]\n  return gradient\n}\n```\n\n#### Image colors\n```swift\nlet image = UIImage(named: \"My Image\")\nlet (background, primary, secondary, detail) = image.colors()\n```\n\n#### Components\nYou can get red, green, blue, and alpha components from any UIColor by using the (red|green|blue|alpha)Component property.\n\n```swift\nlet myColor = UIColor(hex: \"#ffafc2\")\nlet myColorBlueComponent = myColor.blueComponent\nlet myColorGreenComponent = myColor.greenComponent\nlet myColorRedComponent = myColor.redComponent\nlet myColorAlphaComponent = myColor.alphaComponent\n```\n\n#### Blending\n```swift\nlet red = UIColor.redColor()\nlet green = UIColor.greenColor()\nlet yellow = red.addRGB(green)\n\nlet desaturatedBlue = UIColor(hex: \"#aaaacc\")\nlet saturatedBlue = desaturatedBlue.addHue(0.0, saturation: 1.0, brightness: 0.0, alpha: 0.0)\n```\n\n## Supporting the project\n\nIf you want to support the development of this framework, you can do so by becoming a [sponsor](https://github.com/sponsors/zenangst). ❤️\n\n## Examples\n\u003cimg src=\"https://raw.githubusercontent.com/hyperoslo/Hue/master/Images/hex-screenshot.png\" alt=\"Hex Example screenshot\" align=\"right\" /\u003e\n\n#### Hex\nThis super simple example that displays a bunch of color schemes in a Carousel view.\n\nIt uses hex to set the color for the schemes. It leverages from `.isDarkColor` to make the text color readable in all scenarios.\n\nThe demo also features [Spots](http://github.com/hyperoslo/Spots) for rendering the Carousel view.\n\n**Example code:**\n\n```swift\nlet color = UIColor(hex: \"#3b5998\")\nbackgroundColor = color\nlabel.textColor = color.isDark\n  ? UIColor.whiteColor()\n  : UIColor.darkGrayColor()\n```\n\n#### Gradients\n\u003cimg src=\"https://raw.githubusercontent.com/hyperoslo/Hue/master/Images/gradients-screenshot.gif\" alt=\"Gradients Example screenshot\" align=\"right\" width=\"236\" /\u003e\n\nThis examples shows how much fun you can have with combining `CAGradientLayer` with `CABasicAnimation`.\n\nIt uses `.hex` for getting the colors and `.gradient()` for transforming\na collection of `UIColor`'s into a `CAGradientLayer`.\n\nThe demo features [Spots](http://github.com/hyperoslo/Spots) for rendering the list view and [Fakery](https://github.com/vadymmarkov/Fakery) for generating random content strings.\n\n**Extract from the demo:**\n```swift\nlazy var gradient: CAGradientLayer = [\n  UIColor(hex: \"#FD4340\"),\n  UIColor(hex: \"#CE2BAE\")\n  ].gradient { gradient in\n    gradient.speed = 0\n    gradient.timeOffset = 0\n\n    return gradient\n  }\n```\n\n## Installation\n\n**Hue** is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'Hue'\n```\n\n**Hue** is also available through [Carthage](https://github.com/Carthage/Carthage).\nTo install just write into your Cartfile:\n\n```ruby\ngithub \"hyperoslo/Hue\"\n```\n\nTo install **Hue** using [Swift Package Manager](https://swift.org/package-manager) with Xcode 11, just follow the instructions at \u003chttps://developer.apple.com/documentation/swift_packages\u003e and import the platform specific library to the project:\n\n```swift\nimport Hue\n```\n\n## Author\n\n[Hyper](http://hyper.no) made this with ❤️\n\n## Contribute\n\nWe would love you to contribute to **Hue**, check the [CONTRIBUTING](https://github.com/hyperoslo/Hue/blob/master/CONTRIBUTING.md) file for more info.\n\n## Credits\n\nCredit goes out to Panic Inc who created [ColorArt](https://github.com/panicinc/ColorArt) and [@jathu](https://github.com/jathu) for his work on [UIImageColors](https://github.com/jathu/UIImageColors) which deeply inspired the functionality behind the image color analysis.\n\n## License\n\n**Hue** is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenangst%2Fhue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzenangst%2Fhue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzenangst%2Fhue/lists"}