Create complementary gradients generated from dominant and prominent colors in supplied image. Inspired by Grade.js

Overview

codebeat badge

ComplimentaryGradientView

Create complementary gradients generated from dominant and prominent colors in supplied image. Inspired by Grade.js ❤️

.all
gradientStartPoint: left
colors(start: .primary, end: .background)
gradientStartPoint:top

colors(start: .detail, end: .background)
gradientStartPoint:top |
colors(start: .secondary, end: .background)
gradientStartPoint:bottom :-------------------------:|:-------------------------: |

Demo

Sorry for the poor quality gif

Demo

Usage

Code

let gradientView = ComplimentaryGradientView(frame: CGRect(x: 0, y: 0, width: 300, height: 300))

//Colors for gradient are derived from the provided image
gradientView.image = UIImage(named: "myImg")

gradientView.gradientTpye = .colors(start: .primary, end: .secondary)

// Default = `.left`
gradientView.gradientStartPoint = .left

// Default = `.high`
gradientView.quality = .high

Storyboard

Demo

Migration Guide.

Version 3.0 introduces GradientVariant and reduces GradientType to two simple options:

// Create a gradient using all colors found in image
 case all 
 // Create gradient using variants. ie. .colors(start: .primary, end: .detail) 
 case colors(start: GradientVariant, end: GradientVariant) 

Installation

CocoaPods

ComplimentaryGradientView is available through CocoaPods. To install it, simply add the following line to your Podfile:

Swift 4.2

pod 'ComplimentaryGradientView', '~> 3.0'

Swift3.

pod 'ComplimentaryGradientView', '~> 0.1.7'

Swift 2.2

pod 'ComplimentaryGradientView', '~> 0.1.0'

Manually

Download and drop ComplimentaryGradientView.xcodeproj into your project OR Drag Source folder into your project.

Dependencies

UIImageColors

License

ComplimentaryGradientView is available under the MIT license. See the LICENSE file for more info.

You might also like...
Create an '.icns' file from any image

createicns Create an '.icns' file from any image. Usage This command line tool makes it incredibly simple to create an '.icns' icon file from an image

📷 A composable image editor using Core Image and Metal.
📷 A composable image editor using Core Image and Metal.

Brightroom - Composable image editor - building your own UI Classic Image Editor PhotosCrop Face detection Masking component 🎉 v2.0.0-alpha now open!

An image download extension of the image view written in Swift for iOS, tvOS and macOS.
An image download extension of the image view written in Swift for iOS, tvOS and macOS.

Moa, an image downloader written in Swift for iOS, tvOS and macOS Moa is an image download library written in Swift. It allows to download and show an

📷 A composable image editor using Core Image and Metal.
📷 A composable image editor using Core Image and Metal.

Brightroom - Composable image editor - building your own UI Classic Image Editor PhotosCrop Face detection Masking component 🎉 v2.0.0-alpha now open!

AsyncImage before iOS 15. Lightweight, pure SwiftUI Image view, that displays an image downloaded from URL, with auxiliary views and local cache.

URLImage URLImage is a SwiftUI view that displays an image downloaded from provided URL. URLImage manages downloading remote image and caching it loca

AYImageKit is a Swift Library for Async Image Downloading, Show Name's Initials and Can View image in Separate Screen.
AYImageKit is a Swift Library for Async Image Downloading, Show Name's Initials and Can View image in Separate Screen.

AYImageKit AYImageKit is a Swift Library for Async Image Downloading. Features Async Image Downloading. Can Show Text Initials. Can have Custom Styles

A complete Mac App: drag an image file to the top section and the bottom section will show you the text of any QRCodes in the image.

QRDecode A complete Mac App: drag an image file to the top section and the bottom section will show you the text of any QRCodes in the image. QRDecode

An instagram-like image editor that can apply preset filters passed to it and customized editings to a binded image.
An instagram-like image editor that can apply preset filters passed to it and customized editings to a binded image.

CZImageEditor CZImageEditor is an instagram-like image editor with clean and intuitive UI. It is pure swift and can apply preset filters and customize

Convert the image to hexadecimal to send the image to e-paper

ConvertImageToHex Convert the image to hexadecimal to send the image to e-paper Conversion Order // 0. hex로 변환할 이미지 var image = UIImage(named: "sample

Comments
  • Setting image programmatically with a URLRequest

    Setting image programmatically with a URLRequest

    Are images able to be set without specifying the image name in the Storyboard? For some reason, when I set the image programmatically, to either an image in the project or one downloaded from the web, it doesn't work unless I specify it in the storyboard as well.

    @IBOutlet weak var gradientBG: ComplimentaryGradientView!
    
    let bg : UIImage = largeImage
    self.gradientBG.image = UIImage(named: "test.png")
    self.gradientBG.gradientTpye = .backgroundPrimary
    self.gradientBG.gradientStartPoint = .left
    

    This works when I set the following in Storyboard: screen shot 2016-10-10 at 4 12 29 pm

    However, because I want to generate a gradient from an image downloaded from the web, I cannot set it's filename in Storyboard.

    Is there something I'm missing to be able to set a gradient on an image without specifying it's name in Storyboard?

    Thank you for the fantastic project!

    opened by surayashivji 8
  • performance issues

    performance issues

    fixed performance issues:

    • avoid recalculate gradient colours everiytime on layout
    • avoid to resize images which width is lower that 250px

    now gradient layer is always insert as background layer

    fixed demo application - now image is subview in gradient view

    added gitignore

    opened by krezzoid 2
  • Manual Installation

    Manual Installation

    CocoaPods and Carthage are awesome tools and make our life really easier, but there are some devs who still don't know how to use them.

    It would be cool to add the Manual installation guide in your README.md. You can take a look at my iOS Readme Template to see how you can do it.

    opened by lfarah 1
  • Add custom start and endPoint of gradient programmatically

    Add custom start and endPoint of gradient programmatically

    CustomPoints typealias to modify start and end points of gradient programmatically

    public typealias CustomPoints = (startPoint: CGPoint, endPoint: CGPoint)
    
    opened by gkye 0
Owner
George Kye
George Kye
ColorKit makes it easy to find the dominant colors of an image

ColorKit ColorKit is your companion to work with colors on iOS. Features Installation Sample Project Contributing License Features Dominant Colors Col

Boris Emorine 570 Jan 5, 2023
Photo Browser / Viewer inspired by Facebook's and Tweetbot's with ARC support, swipe-to-dismiss, image progress and more

IDMPhotoBrowser IDMPhotoBrowser is a new implementation based on MWPhotoBrowser. We've added both user experience and technical features inspired by F

Thiago Peres 2.7k Dec 21, 2022
Read colors from Xcode assets file.

XcodePalette Read colors from Xcode assets file. How to Use Download the XcodePalette.Executable.zip of the latest release. Extract the XcodePalette U

iMoeNya 0 Nov 12, 2021
The repository for a command line / build pipeline tool for generating colors from a human-readable text file that designers can also use.

ColorPaletteGenerator ColorPaletteGenerator is a tool that takes a human-readable input file describing a color palette, and generates the associated

horseshoe7 0 Dec 7, 2021
Terminal Colors for Swift

Terminal string styling for Swift Colors is a clean and focused solution for string styling in Swift. Usage import Colors print(Colors.blue("Blue str

Paulo Tanaka 94 Sep 9, 2022
An Xcode plugin to improve dealing with colors in your project

Crayons is an Xcode7 plugin with various features that improve working with colors in your projects ##Code palettes (iOS only) You can share palettes

Fabio Ritrovato 477 Sep 23, 2022
SwiftColorArt is a demo application that includes Swift files with all classes and extension necessary to create a font color schema matching to an image

SwiftColorArt SwiftColorArt is a demo application that includes Swift files with all classes and extension necessary to create a font color schema mat

Jan Gregor Triebel 264 Jan 4, 2023
How to create a circular and rectangular ImageView with similar image?

chapter11CircularAndRectangularImage How to create a circular and rectangular ImageView with similar image? I add two imageView in Main.storyboard I a

ahmetbostanciklioglu 0 Jan 8, 2022
Twitter Image Pipeline is a robust and performant image loading and caching framework for iOS clients

Twitter Image Pipeline (a.k.a. TIP) Background The Twitter Image Pipeline is a streamlined framework for fetching and storing images in an application

Twitter 1.8k Dec 17, 2022
Image slide-show viewer with multiple predefined transition styles, with ability to create new transitions with ease.

ATGMediaBrowser ATGMediaBrowser is an image slide-show viewer that supports multiple predefined transition styles, and also allows the client to defin

null 200 Dec 19, 2022