Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wvabrinskas/Avatar
Generate random user Avatars for apps.
https://github.com/wvabrinskas/Avatar
Last synced: 6 days ago
JSON representation
Generate random user Avatars for apps.
- Host: GitHub
- URL: https://github.com/wvabrinskas/Avatar
- Owner: wvabrinskas
- License: mit
- Created: 2017-06-13T20:51:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-10T15:24:39.000Z (over 5 years ago)
- Last Synced: 2024-10-31T16:34:42.211Z (about 1 month ago)
- Language: Ruby
- Size: 505 KB
- Stars: 24
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - Avatar - Generate random user Avatar images using CoreGraphics and QuartzCore. (Media / Image)
- awesome-ios-star - Avatar - Generate random user Avatar images using CoreGraphics and QuartzCore. (Media / Image)
README
# Avatar
Generate random user Avatars for apps.
Works for iOS 9.3+
![](https://github.com/wvabrinskas/Avatar/blob/master/public/Avatar.gif)
# Installation
* Simply install using Cocoapods, add `'pod Avatar'` to your podfile# Simple to use
* `import Avatar`
* Get a random user avatar by running `let avatar = Avatar.generate(for: avatar.frame.size, scale: 20)`
* `avatar.frame.size` is the size of your UIImageView for the avatar
* `scale` is the pixel size of each color generated, aka. the resolution
* Get a random user avatar and the seed by runningAvatar.generate(for: avatar.frame.size, scale: 20) { (seed, avatarImage) in
}
* `AvatarSeed` has the available properties:
* `scale: Int` - resolution of each square of the image
* `map: [Int]` - the layout map of the colors represented by an `Int` from 0 to 2
* `size: CGSize` - size of the overall image
* `colors: Colors` - tuple that contains the primary, secondary, and tertiary colors of the image.
* Can be created by calling: `let seed = AvatarSeed(map: map, colors: colors, size: size, scale: scale)`