Giter Site home page Giter Site logo

uicolor-hexutils's Introduction

UIColor+HexUtils Badge w/ Version Platform Carthage compatible Build Status license MIT

UIColor-HexUtils is a category for Hexadecimal Colors Support for UIColor. Support for prefixed # (#FFFFFF) or without (FFFFFF) Hexadecimal Colors.

RELEASE 2.0

Upgrade to Swift 5.

RELEASE 1.1

Updated Demo Project for CocoaPods and Fixes.

RELEASE 1.0

The base UIColor+Hex category with the required hex transformation functions.

Examples

Swift 5.0

// with hash
let colorHash = UIColor(hex: "#FFFFFF")

// without hash
let colorNoHash = UIColor(hex: "FFFFFF")

// short Hex
let colorShort = UIColor(hex: "FFF")

Demo Project

Check on Example Directory for the UIColor-HexUtilsExample project with Unit Tests.

Installation

CocoaPods

platform  :ios

target 'YourTarget' do
  pod 'UIColor-HexUtils', :git => "https://github.com/devcarlos/UIColor-HexUtils.git"
end

  • import UIColor+HexUtils where you want to use UIColor+HexUtils extensions

Carthage

  1. Get Carthage by running brew install carthage or choose another installation method

  2. Create a [Cartfile][] in the same directory where your .xcodeproj or .xcworkspace is

  3. List the desired dependencies in the [Cartfile][], for example:

    github "UIColor-HexUtils"
    
  4. Run carthage update

  5. A Cartfile.resolved file and a Carthage directory will appear in the same directory where your .xcodeproj or .xcworkspace is

  6. Drag the built .framework binaries from Carthage/Build/<platform> into your application’s Xcode project.

  7. If you are using Carthage for an application, follow the remaining steps, otherwise stop here.

  8. On your application targets’ Build Phases settings tab, click the + icon and choose New Run Script Phase. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:

    /usr/local/bin/carthage copy-frameworks
  • Add the paths to the frameworks you want to use under “Input Files". For example:

    $(SRCROOT)/Carthage/Build/iOS/UIColor_HexUtils.framework
    
  • Add the paths to the copied frameworks to the “Output Files”. For example:

    $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/UIColor_HexUtils.framework
    

Requirements

UIColor+HexUtils requires iOS 10.0 and above.

Credits

UIColors+HexUtils was created by Carlos Alcala because I was using in a lot of projects and wanted to contribute (and avoid the pain to always search for this functionality).

Creator

Carlos Alcala @carlosalcala

License

UIColors-HexUtils is available under the MIT license. See the LICENSE file for more info.

uicolor-hexutils's People

Contributors

devcarlos avatar

Stargazers

 avatar

Watchers

 avatar 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.