Skip to content
/ XColor Public

XColor is a color handling extension for UIColor written in Swift.

License

Notifications You must be signed in to change notification settings

jaumevn/XColor

Repository files navigation

Build Status codecov Carthage Compatible Cocoapods Cocoapods platforms GitHub

XColor

XColor is a color handling extension for UIColor written in Swift.

Examples

XColor supports alpha channel with implicit and explicit convenience initializers:

// Set alpha with 8 character representation
let colorAlphaString = UIColor("#5F7EFB50")

// Set alpha channel with explicit convenience init
let colorAlphaExplicit = UIColor("#5F7EFB", alpha: 0.5)

You can use multiple character representations:

// 3 character representation
let color3CharString = UIColor("#57F")

// 6 character representation
let color6CharString = UIColor("#5F7EFB")

// 8 character representation (alpha channel)
let color8CharString = UIColor("#5F7EFB50")

Define your colors with hex string or number:

// Create solid colors with hex string or hex number
let colorString = UIColor("#5F7EFB")
let colorNumber = UIColor(0xFF3033)

Installation

Cocapods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate XColor into your Xcode project using CocoaPods, specify it in your Podfile:

pod "XColor"

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate XColor into your Xcode project using Carthage, specify it in your Cartfile:

github "jaumevn/XColor"

Requirements

  • iOS 8.0+
  • Xcode 10.2+
  • Swift 5+

Credits

XColor is owned and maintained by Jaume Viñas Navas

License

XColor is released under the MIT license. See LICENSE for details.