{"id":905,"url":"https://github.com/onevcat/RandomColorSwift","last_synced_at":"2025-07-30T19:32:58.176Z","repository":{"id":26275535,"uuid":"29722967","full_name":"onevcat/RandomColorSwift","owner":"onevcat","description":"An attractive color generator for Swift. Ported from randomColor.js.","archived":false,"fork":false,"pushed_at":"2020-04-13T09:15:20.000Z","size":107,"stargazers_count":633,"open_issues_count":2,"forks_count":50,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-11-28T11:39:47.443Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"nick/react-native-carousel","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/onevcat.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-01-23T08:06:53.000Z","updated_at":"2024-10-24T09:15:08.000Z","dependencies_parsed_at":"2022-08-26T20:22:28.375Z","dependency_job_id":null,"html_url":"https://github.com/onevcat/RandomColorSwift","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onevcat%2FRandomColorSwift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onevcat%2FRandomColorSwift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onevcat%2FRandomColorSwift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onevcat%2FRandomColorSwift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onevcat","download_url":"https://codeload.github.com/onevcat/RandomColorSwift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228179003,"owners_count":17881121,"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":[],"created_at":"2024-01-05T20:15:34.333Z","updated_at":"2024-12-04T19:32:17.421Z","avatar_url":"https://github.com/onevcat.png","language":"Swift","funding_links":[],"categories":["Color","Libs","Swift","UI Component"],"sub_categories":["Linter","Other free courses","Colors"],"readme":"# Random Color Swift\n\nInspired by David Merfield's [randomColor.js](https://github.com/davidmerfield/randomColor). It is a ported version to Swift. You can use the library to generate attractive random colors on iOS or macOS.\n\n![](https://raw.githubusercontent.com/onevcat/RandomColorSwift/master/demo.png)\n\n## Install\n\nThis framework supports Swift 4.0/4.2/5.0 and above.\n\n### Swift Package Manager\n\nJust like using any other Swift Package, add this repo to the `dependencies` section and depend it in your target:\n\n```swift\nlet package = Package(\n    name: \"MyApp\",\n    //...\n    dependencies: [\n        .package(url: \"https://github.com/onevcat/RandomColorSwift.git\", .upToNextMajor(from: \"2.0.0\")),\n    ],\n    targets: [\n        .target(\n            name: \"MyApp\",\n            dependencies: [\"RandomColor\"]),\n    ]\n```\n\nOr, use the Swift Package Manager integrated in Xcode 11 or above to [add this package as a dependency to your app](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app).\n\n### CocoaPods\n\nThe easiest way to use `RandomColor` is installing it by [CocoaPods](http://cocoapods.org). Add these lines to your Podfile:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '8.0'\n# platform :osx, '10.10'\nuse_frameworks!\n\npod 'RandomColorSwift'\n```\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is also supported:\n\n```ogdl\ngithub \"onevcat/RandomColorSwift\"\n```\n\n### Manually\n\nIf you need to support iOS 7.x, you will need to add the library manually into your project since dynamic framework is not supported for iOS 7.\n\nClone this repo and throw the source files under `RandomColor` folder into your project to use it. \n\n## Example\n\n```swift\nimport RandomColor\n\n// Returns a UIColor or NSColor object for an attractive color\nlet color = randomColor()\n\n// Returns an array of ten green colors\nlet greenColors = randomColors(count: 10, hue: .green)\n\n// Returns a color for light blue\nlet lightBlurColor = randomColor(hue: .blue, luminosity: .light)\n\n// Returns a color for a 'truly random' color\nlet randomColor = randomColor(hue: .random, luminosity: .random)\n\n// Returns an array of ten dark pink colors\nlet darkPinkColors = randomColors(count: 10, hue: .pink, luminosity: .dark)\n\n// Returns an array of twenty colors at hue of 120\nlet colors = randomColors(count: 20, hue: .value(120), luminosity: .random)\n\n```\n\nThere is also a demo project in this repo.\n\n## Options\n\nYou can pass an options object to influence the type of color it produces. The options object accepts the following properties:\n\n**Hue** – Controls the hue of the generated color. Possible hue values for colors are `.monochrome`, `.red`, `.orange`, `.yellow`, `.green`, `.blue`, `.purple`, `.pink`, `.random` or `.value(Int)`. If you use `.value(Int)`, you should pass an `Int` between 0 and 360.\n\n**Luminosity** – Controls the luminosity of the generated color. You can pass `.bright`, `.light`, `.dark` or `.random`.\n\n**Count** – An `Int` which specifies the number of colors to generate.\n\n## Acknowledgements\n\nThanks for David Merfield bringing us randomColor.js, which is a great utility.\n\nThe demo project is using Chirag Mehta's [Name the Color](http://chir.ag/projects/name-that-color) JavaScript library to extract name of color.\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonevcat%2FRandomColorSwift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonevcat%2FRandomColorSwift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonevcat%2FRandomColorSwift/lists"}