ComplimentaryGradientView 0.3.0

ComplimentaryGradientView 0.3.0

测试已测试
Lang语言 SwiftSwift
许可证 MIT
发布最后发布2018年9月
SPM支持SPM

George KyeGeorge Kye维护。



codebeat badge

ComplimentaryGradientView

创建由提供的图像中的主导色和突出色生成的互补渐变。灵感来源于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

演示

关于GIF质量不高的抱歉

Demo

使用方法

代码

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

故事板

Demo

迁移指南
指南

版本 3.0 引入 GradientVariant 并将 GradientType 简化为两个选项

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

安装

CocoaPods

ComplimentaryGradientView 可通过 CocoaPods 获取。要安装它,只需在 Podfile 中添加以下行

Swift 4.2

pod 'ComplimentaryGradientView', '~> 3.0'

Swift3.

pod 'ComplimentaryGradientView', '~> 0.1.7'

Swift 2.2

pod 'ComplimentaryGradientView', '~> 0.1.0'

手动

下载并将 ComplimentaryGradientView.xcodeproj 拖放到你的项目中 或者Source 文件夹拖放到你的项目中。

依赖项

UIImageColors

许可证

ComplimentaryGradientView 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。