Colour set
ColorKit is your companion for working with flowers on iOS.
Characteristics
Dominant colours
With ColorKit you can easily find the dominant colors of your image. Returns the color palette of the most common colors in the image.
let dominantColors = try image.dominantColors()
By default, ColorKit uses an iterative process to determine the dominant colors of the image. However, it also does so with the k-mean clustering algorithm. Choose what best suits your application.
Colour palette
With ColorKit you can generate color palettes from your color collection. It automatically ensures that the best colours are selected based on various configurable parameters, such as contrast.
This function is especially effective in combination with the dominant color calculation.
let color = try image.dominColors()
let palette = color palette (orderedColors : colors, ignoreContrastRatio : true)
In the following examples, the palette is used to dynamically adjust the text and background colors of the album illustrations.
Medium colour
To calculate the average color of an image, call the AverageColor function in a UIImage instance.
let averageColor = try the image.averageColor()
Colour difference (DeltaE)
The observable difference/comparison of colors is a common problem in color science.
It’s just a matter of calculating how two different colors affect the human eye. It’s usually called DeltaE.
With ColorKit it is easy to compare two colours.
let colorDifference = UIColor.green.difference (from : .white) // 120.34
Although it may seem trivial, the simple use of an RGB color model often leads to inaccurate results for human perception.
This is due to the fact that the RGB is not seen as a whole.
Here is an example illustrating the limitations of using the RGB colour model for colour comparison
As you can see, the difference between two shades of green (left) is considered larger than the difference between pink and grey (right). In other words, pink and grey are considered more similar to two greens.
This clearly does not meet the expectations of the human eye.
Fortunately, ColorKit offers algorithms that allow you to compare colors in the same way as the human eye: CIE76, CIE94 and CIEDE2000.
leave colorDifference = UIColor.green.difference (from: .white, using: .CIE94)
Let’s give the same example as above, using the CIE94 algorithm.
The CIE94 algorithm successfully understands that two greens (left) are closer together than pink and grey (right).
You can find more information about color reproduction here.
Contrast ratio
To calculate the contrast ratio between two colors, simply use the ContrastRatio function.
Either the contrast ratio = UIColor.green.contrastRatio (with: UIColor.white)
The contrast ratio is especially important when displaying text.
To ensure readability for all, ColorKit enables you to easily follow the accessibility guidelines of WCAG 2.
Colour space conversion
ColorKit helps you transfer colour from one colour space to another.
They are simply supported as an extension of UIColor.
Supports CIELAB, XYZ and CMYK.
More than
ColorKit offers much more.
Here is a short list of examples:
- Working with hexagonal colour codes
let hexValue = UIColor.green.hex
let color = UIColor(hex: eb4034)
let randomColor = UIColor.random()
- Calculation of relative colour brightness
Leave the relative luminance = UIColor.green.relativeluminance
- Creation of extra colours
be it UIColor.green.complementaryColor
Equipment
SwiftPackage Manager
The Swift package manager is the easiest way to install and manage ColorKit as required.
Just add ColorKit to your dependencies in your Package.fast file:
Research: [
.package(url: https://github.com/Boris-Em/ColorKit.git)
]
You can also use XCode to add ColorKit to your existing project by going to File > Quick Packages > Add Dependency Package……. selecting.
Manual
ColorKit can also be added to your project manually. Download Github’s ColorKit project and then drag and drop the ColorKit/ColorKit folder to your XCode project.
Design samples
Use the iOS example project included in this directory to find complete examples of the various ColorKit features.
GitHub
Related Tags:
ernest saves christmas full movie,ernest saves christmas nostalgia critic,ernest saves christmas rotten tomatoes,ernest saves christmas dvd,ernest saves christmas reindeer scene,noelle parker,ernest saves christmas soundtrack,ernest saves halloween,ernest goes to africa,ernest goes to jail rotten tomatoes,ernest goes to school video trailer,ernest goes to camp rating,christmas movies,ernest goes to camp letterboxd,christmas movies letterboxd,bad santa letterboxd,ernest goes to camp common sense media,ernest gets beat up,ernest goes to camp indian,ernest goes to school,ernest movies,ernest saves christmas cast,ernest saves christmas trailer,ernest saves christmas 123movies,ernest saves christmas streaming,ernest saves christmas blu-ray,ernest saves christmas youtube