Skip to content

Instantly share code, notes, and snippets.

@ahknight
Created August 18, 2014 14:52
Show Gist options
  • Save ahknight/d2bee8283c3173146ebc to your computer and use it in GitHub Desktop.
Save ahknight/d2bee8283c3173146ebc to your computer and use it in GitHub Desktop.

Revisions

  1. ahknight created this gist Aug 18, 2014.
    6 changes: 6 additions & 0 deletions uicolor+hex.m
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    #define UICOLOR_FROM_HEX(x) [UIColor colorWithRed:(((NSUInteger)(x & 0xff0000) >> 16)/255.) \
    green:(((NSUInteger)(x & 0x00ff00) >> 8)/255.) \
    blue:(((NSUInteger)(x & 0x0000ff))/255.) \
    alpha:1.0]

    UIColor *color = UICOLOR_FROM_HEX(0xff00ff);