Skip to content

mbcharbonneau/Color-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ColorGenerator.swift

ColorGenerator.swift is a collection of methods to create random colors for your UI. Drop it into your Xcode project to use it. A sample project is included.

If you have questions, you can find me on Twitter @mbcharbonneau.

iPhone Simulator

Usage

random()

Each call to randomColor() will return a new UIColor instance that's visually distinct from the previous color. This makes it ideal for coloring buttons or other elements where the total number of colors needed is not known beforehand.

gradientColors()

Returns a pair of UIColor objects for use in a basic linear gradient. See GradientView.swift in the sample project for an example using CAGradientLayer.

variation(baseColor:UIColor, distance:CGFloat)

Returns a random variant of the given UIColor. The distance value controls how much the base color is changed.

About

🎨 Randomized colors for your iOS or macOS app.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages