--- /dev/null
+//
+// UIImage+Ext.swift
+// WolneLektury
+//
+// Created by Pawel Dabrowski on 30/05/2018.
+// Copyright © 2018 Fundacja Nowoczesna Polska. All rights reserved.
+//
+
+import Foundation
+import UIKit
+
+extension UIImage{
+
+ static func imageFromColor(colour: UIColor) -> UIImage? {
+ let rect = CGRect(x: 0, y: 0, width: 1, height: 1)
+ UIGraphicsBeginImageContext(rect.size)
+ if let context = UIGraphicsGetCurrentContext() {
+ context.setFillColor(colour.cgColor)
+ context.fill(rect)
+
+ let image = UIGraphicsGetImageFromCurrentImageContext()
+ UIGraphicsEndImageContext()
+ return image
+ }
+ return nil
+ }
+}