Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the standard Apple blue colour?

Here's an extract from ...

//
//  UIColor.h
//  UIKit
//
//  Copyright (c) 2005-2013, Apple Inc. All rights reserved.
//

 ........ 

// Some convenience methods to create colours.
// These colors will be as calibrated as possible.
// These colors are cached.
+ (UIColor *)blackColor;      // 0.0 white 
+ (UIColor *)darkGrayColor;   // 0.333 white 
+ (UIColor *)lightGrayColor;  // 0.667 white 
+ (UIColor *)whiteColor;      // 1.0 white 
+ (UIColor *)grayColor;       // 0.5 white 
+ (UIColor *)redColor;        // 1.0, 0.0, 0.0 RGB 
+ (UIColor *)greenColor;      // 0.0, 1.0, 0.0 RGB 
+ (UIColor *)blueColor;       // 0.0, 0.0, 1.0 RGB 
+ (UIColor *)cyanColor;       // 0.0, 1.0, 1.0 RGB 
+ (UIColor *)yellowColor;     // 1.0, 1.0, 0.0 RGB 
+ (UIColor *)magentaColor;    // 1.0, 0.0, 1.0 RGB 
+ (UIColor *)orangeColor;     // 1.0, 0.5, 0.0 RGB 
+ (UIColor *)purpleColor;     // 0.5, 0.0, 0.5 RGB 
+ (UIColor *)brownColor;      // 0.6, 0.4, 0.2 RGB 
+ (UIColor *)clearColor;      // 0.0 white, 0.0 alpha 

Incredibly, they do not include "standard Apple 'button blue'" ........

enter image description here

In projects, we always have this: but it's a bit of a wild guess.

#define APPLEBLUE [UIColor \
  colorWithRed:0/255.0 green:122/255.0 blue:255/255.0 alpha:1.0]

Alternately, you can do something insanely complex like this.........

@implementation SomeButtons
{
UIColor *defaultColor;
}

-(id)initWithFrame:(CGRect)frame
    {
    defaultColor = [UIColor redColor];
    if(self = [super initWithFrame:frame])
        {
        for (UIView *v in self.subviews)
          if ([v isKindOfClass:[UIButton class]])
            defaultColor = [(UIButton *)v titleColorForState:UIControlStateNormal];
        }
    return self;
    }

-(id)initWithCoder:(NSCoder *)aCoder
    {
    if(self = [super initWithCoder:aCoder])
        {
        for (UIView *v in self.subviews)
          if ([v isKindOfClass:[UIButton class]])
            defaultColor = [(UIButton *)v titleColorForState:UIControlStateNormal];
        }
    return self;
    }

It seems almost unbelievable there is not, an easier way, to return to "standard Apple control blue" for button and text colors.

This is the sort of thing Android programmers laugh at us about :/ Does anyone know an easier way? I really hope I'm missing something obvious. Cheers

like image 467
Fattie Avatar asked Jul 08 '14 17:07

Fattie


Video Answer


2 Answers

A bit late, but you can find the colour values in Apple's Human interface guidelines.

The blue is (R, G, B) = (0, 122, 255) = #007AFF

Apple colours

I created a GIST with UIColor extension for your convenience.

like image 191
David Rysanek Avatar answered Oct 16 '22 16:10

David Rysanek


Try the digital color meter? It seems to think (14, 122, 254).

enter image description here

Then add a category:

@implementation UIColor (MyColors)

+ (UIColor*)appleBlue {
    return [UIColor colorWithRed:14.0/255 green:122.0/255 blue:254.0/255 alpha:1.0];
}

@end
like image 21
i_am_jorf Avatar answered Oct 16 '22 17:10

i_am_jorf