Latest 1.0.0
Homepage https://github.com/jasonnam/HexString
License MIT
Platforms ios 8.0, requires ARC
Authors

Convert hex color value to color

Installation

Platform iOS
Swift 4.0
Travis-CI
Carthage compatible
Version

Carthage

github "jasonnam/HexString"

CocoaPods

use_frameworks!
pod 'HexString'

Manual

Just copy the file ‘UIColor+HexString.swift’ into your project.

Usage

Get UIColor from Hex Color String

// If hex string is not valid, init with white color.
view.backgroundColor = UIColor(hexColorString: "#123456")

Get Hex String from UIColor

print(UIColor.red.hexColorString)

The Result will be in the form of #RRGGBB or #AARRGGBB

There is also an extension for String class.

view.backgroundColor = "#123456".toColor()

Available formats

  • RGB

  • ARGB

  • RRGGBB

  • AARRGGBB

Contact

Any feedback and pull requests are welcome :)

Jason Nam
Website
Email

License

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

Latest podspec

{
    "name": "HexString",
    "version": "1.0.0",
    "summary": "Convert Hex String into UIColor / Written in Swift",
    "description": "Convert hex string color into UIColor and vice versa.nThis also validate the hex string color.nnAvailable formatsn#RGBn#ARGBn#RRGGBBn#AARRGGBB",
    "homepage": "https://github.com/jasonnam/HexString",
    "screenshots": "https://raw.githubusercontent.com/jasonnam/HexString/master/SCREENSHOT.png",
    "authors": {
        "Jason Nam": "[email protected]"
    },
    "social_media_url": "http://www.jasonnam.com",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/jasonnam/HexString.git",
        "commit": "13455ecf88034cecc2141dc0eed5138bc6c12b97",
        "tag": "1.0.0"
    },
    "source_files": "UIColor+HexString.swift",
    "requires_arc": true,
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This