Skip to content

Instantly share code, notes, and snippets.

@samuelbeek
Created October 2, 2015 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samuelbeek/4fbe2a346a2738417773 to your computer and use it in GitHub Desktop.
Save samuelbeek/4fbe2a346a2738417773 to your computer and use it in GitHub Desktop.
//
// ColorHelper.swift
// Wildcard
//
// Created by Samuel Beek on 24/06/15.
// Copyright (c) 2015 Wildcard. All rights reserved.
//
import UIKit
// HEX color
extension UIColor {
class func fromRGB(rgb:UInt32) -> UIColor {
return UIColor(
red: CGFloat((rgb & 0xFF0000) >> 16) / 255.0,
green: CGFloat((rgb & 0x00FF00) >> 8) / 255.0,
blue: CGFloat(rgb & 0x0000FF) / 255.0,
alpha: CGFloat(1.0)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment