Colour set

ColorKit is your companion for working with flowers on iOS.


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.

Advanced color manipulation for iOS

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 = (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

Advanced color manipulation for iOS

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 = (from: .white, using: .CIE94)

Let’s give the same example as above, using the CIE94 algorithm.

Advanced color manipulation for iOS

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 = (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 =
let color = UIColor(hex: eb4034)

let randomColor = UIColor.random()

  • Calculation of relative colour brightness

Leave the relative luminance =

  • Creation of extra colours

be it


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 file:

Research: [

You can also use XCode to add ColorKit to your existing project by going to File > Quick Packages > Add Dependency Package……. selecting.


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.


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

You May Also Like

🥇 Calculate the Cost of a Product in Excel  Step by Step Guide ▷ 2020

If you want to sell a product or offer a service to…

🥇 MICROSOFT POWERPOINT  What is it? + Alternatives ▷ 2020

One of the advantages of using Office software packages is that you…

Pytorch Image Augmentation using Transforms.

In-depth learning models generally require a lot of data for learning. In…

Fix: Google Photos not backing up on iPhone

For many iPhone users, Google Photos remains the first choice, even though…