Giter VIP home page Giter VIP logo

complimentarygradientview's Introduction

codebeat badge

ComplimentaryGradientView

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

allColors/left primaryBackground/top
detailBackground/top secondaryBackground/bottom

Demo

Sorry for the poor quality gif

Installation

CocoaPods

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

Swift3.

pod 'ComplimentaryGradientView'

Swift 2.2

pod 'ComplimentaryGradientView', '~> 0.1.0'

Manually

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

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")

//Default = .backgroundPrimary (See GradientType enum for all possible values)
gradientView.gradientTpye = .backgroundPrimary

//Defaut = .Top. Possible values = Ttp, left, right, bottom
gradientView.gradientStartPoint = .left

Storyboard

screen shot 2016-08-24 at 8 38 11 pm

Protocols

optional func complimentaryGradientView(didSetGradient gradientView: ComplimentaryGradientView, gradientSet: Bool)

Graident Types

public enum GradientType: String {
  
  //background
  case backgroundPrimary
  case backgroundSecondary
  case backgroundDetail
  //primary
  case primaryBackground
  case primarySecondary
  case primaryDetail
  //secondary
  case secondaryBackground
  case secondaryPrimary
  case secondaryDetail
  //detail
  case detailBackground
  case detailPrimary
  case detailSecondary
  //AllColors
  case allColors
}

Dependencies

UIImageColors

License

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

complimentarygradientview's People

Contributors

basthomas avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.