Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get iPhone color iOS Sdk

iTunes can detect if my iPhone is black or white, so how can I do this in code?

I'm thinking it would be a UIDevice thing but I'm not too sure.

like image 841
Sam Jarman Avatar asked Jun 06 '12 13:06

Sam Jarman


People also ask

How do I get the exact color on my iPhone?

Use the eyedropper tool to pick an exact color from an image on the screen. It can be useful if you want to match a color on the current document or one from another file. It's also handy if you see a color you like and want to save it for later.

Is there an iPhone app to identify colors?

Color Name is an indispensable assistant to help you choose paints, wallpaper, and decorative elements. Besides, it is a handy instrument for everyday use. Do you want to know what Fuchsia Color looks like? Or emerald-green?

Is iPhone a sRGB?

iPhone uses sRGB color space.

What is Accentcolor in Xcode?

An accent color, or tint color, is a broad theme color that applies to views and controls in your app. Use an accent color to quickly create a unifying color scheme for your app. You can set an accent for your app by specifying an accent color in your asset catalog.


2 Answers

You can obtain color from model part number, for example:

MD381 - black iPhone 4S

MC920 - white iPhone 4S

...

To obtain model number use uidevice-extension

Addition: Alternative solution. Link your project with libLockdown.dylib.

extern id lockdown_connect();
extern id lockdown_copy_value(id, id, id);
extern void lockdown_disconnect();
extern NSString *kLockdownDeviceColorKey;
NSString* CopyDeviceColor() {
    id connection = lockdown_connect();
    NSString *color = lockdown_copy_value(connection, nil, kLockdownDeviceColorKey);
    NSLog(@"color = %@", color);
    lockdown_disconnect(connection);
    return color;
}
like image 150
Oleg Trakhman Avatar answered Nov 04 '22 07:11

Oleg Trakhman


iTunes detects the color of the device from the serial number I believe.

There is no way to determine the color of the device or developers.

like image 33
WrightsCS Avatar answered Nov 04 '22 07:11

WrightsCS