- December 30, 2024
- Mins Read
Hue is the all-in-one coloring utility that you’ll ever need.
You can easily use hex colors with the init(hex:)
convenience initializer on UIColor
. It supports the following hex formats #ffffff
, ffffff
, #fff
, fff
.alpha
is a sugar for colorWithAlphaComponent
, internally it does the exact same thing, think of it as a lipstick for your implementation.
You can easily create gradient layers using the gradient()
method on arrays with UIColor
. As an extra bonus, you can also add a transform closure if you want to modify the CAGradientLayer
.
You can get red, green, blue, and alpha components from any UIColor by using the (red|green|blue|alpha)Component property.
If you want to support the development of this framework, you can do so by becoming a sponsor. ❤️
This super simple example that displays a bunch of color schemes in a Carousel view.
It uses hex to set the color for the schemes. It leverages from .isDarkColor
to make the text color readable in all scenarios.
The demo also features Spots for rendering the Carousel view.
Example code:
This examples shows how much fun you can have with combining CAGradientLayer
with CABasicAnimation
.
It uses .hex
for getting the colors and .gradient()
for transforming a collection of UIColor
‘s into a CAGradientLayer
.
The demo features Spots for rendering the list view and Fakery for generating random content strings.
Extract from the demo:
Hue is available through CocoaPods. To install it, simply add the following line to your Podfile:
Hue is also available through Carthage. To install just write into your Cartfile:
To install Hue using Swift Package Manager with Xcode 11, just follow the instructions at https://developer.apple.com/documentation/swift_packages and import the platform specific library to the project: