Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 4, 2013, 05:13 AM   #1
Mvkoe
macrumors member
 
Join Date: Aug 2008
Location: Belgium
Color naming by value

Hey

I was wondering, is it posible to give the color a name, when you got the hex value of the color.

So if you would have #FFFFFF it would say "White", some apps have this, are they having some sort of algoritme or an pre defined color table with the value's and names in it ?

Grz
Mvkoe is offline   0 Reply With Quote
Old Feb 4, 2013, 06:18 AM   #2
KoolStar
macrumors Demi-God
 
KoolStar's Avatar
 
Join Date: Oct 2006
Location: Kentucky
Send a message via AIM to KoolStar Send a message via Skype™ to KoolStar
Here is the standard web safe html hex colors with names.

Link: http://www.w3schools.com/html/html_colornames.asp
__________________
"Innovation distinguishes between a leader and a follower." : S.J.
KoolStar is offline   0 Reply With Quote
Old Feb 4, 2013, 07:26 AM   #3
Mvkoe
Thread Starter
macrumors member
 
Join Date: Aug 2008
Location: Belgium
Quote:
Originally Posted by KoolStar View Post
Here is the standard web safe html hex colors with names.

Link: http://www.w3schools.com/html/html_colornames.asp
And then the question is, how is it possible that you can select a color, no matter what an gives the name ?
Mvkoe is offline   0 Reply With Quote
Old Feb 4, 2013, 08:19 AM   #4
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Quote:
Originally Posted by albertbarkley View Post
I always wonder that how HEX of RGB is given. Suppose that we have HEX FF7F50 and RGB 255,127,80. My question is that how FF7F50 is calculated or driven from 255,127,80..!! Still i could not find my question from anywhere.
All you do to go from 255, 127, 80 to FF7F50 is replace each of the 3 components with hexadecimal and remove the spaces and/or punctuation between them. To go the other way, break up each pair of characters and then convert from hexadecimal to decimal. Is that the answer to your question?
ArtOfWarfare is offline   0 Reply With Quote
Old Feb 4, 2013, 08:31 AM   #5
Mvkoe
Thread Starter
macrumors member
 
Join Date: Aug 2008
Location: Belgium
Quote:
Originally Posted by ArtOfWarfare View Post
All you do to go from 255, 127, 80 to FF7F50 is replace each of the 3 components with hexadecimal and remove the spaces and/or punctuation between them. To go the other way, break up each pair of characters and then convert from hexadecimal to decimal. Is that the answer to your question?
That's not really a answer on my question lol
Mvkoe is offline   0 Reply With Quote
Old Feb 4, 2013, 09:52 AM   #6
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Quote:
Originally Posted by Mvkoe View Post
And then the question is, how is it possible that you can select a color, no matter what an gives the name ?
So, you want a method where you pass it an RGB value in hex and it returns a name, in a string presumably? Note that many RGB values don't have a HTML color name equivalent and UIColor is even more restrictive. And what would you use this 'name' for?
__________________
dejo is offline   0 Reply With Quote
Old Feb 4, 2013, 10:01 AM   #7
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Quote:
Originally Posted by Mvkoe View Post
That's not really a answer on my question lol
I was answering albertbarkley's, admittedly not quite on topic, question.
ArtOfWarfare is offline   0 Reply With Quote
Old Feb 4, 2013, 10:14 AM   #8
Mvkoe
Thread Starter
macrumors member
 
Join Date: Aug 2008
Location: Belgium
Quote:
Originally Posted by dejo View Post
So, you want a method where you pass it an RGB value in hex and it returns a name, in a string presumably? Note that many RGB values don't have a HTML color name equivalent and UIColor is even more restrictive. And what would you use this 'name' for?
So Yes on your Question. Insert RGB value's ore HSL/HSV, and getting the closest HTML color name equivalent of the UIColor.

And I will use this for myself and other's that are colorblind for choosing the "right" (It's never 100% acurate but it does it) colors.
Mvkoe is offline   0 Reply With Quote
Old Feb 4, 2013, 11:17 AM   #9
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Quote:
Originally Posted by Mvkoe View Post
So Yes on your Question. Insert RGB value's ore HSL/HSV, and getting the closest HTML color name equivalent of the UIColor.
I don't really understand what you're saying here. Is this method returning HTML color names (of which there are 147) or UIColor names (of which there are only 15)?

Quote:
And I will use this for myself and other's that are colorblind for choosing the "right" (It's never 100% acurate but it does it) colors.
If you are having the user pick a color choice, why would you be starting from hex values? Perhaps elaborate some more on why you need this and how your method will be used.
__________________
dejo is offline   0 Reply With Quote
Old Feb 4, 2013, 11:25 AM   #10
Mvkoe
Thread Starter
macrumors member
 
Join Date: Aug 2008
Location: Belgium
Quote:
Originally Posted by dejo View Post
I don't really understand what you're saying here. Is this method returning HTML color names (of which there are 147) or UIColor names (of which there are only 15)?



If you are having the user pick a color choice, why would you be starting from hex values? Perhaps elaborate some more on why you need this and how your method will be used.
Oke so, I'll use this "app" for making my life easier, choosing colors right. Like i'm in a shop, getting a t-shirt and i want to know the color of it.

Take photo, select pixel of the t-shirt. en compare it to the closest HTML color name (http://www.w3schools.com/html/html_colornames.asp)
Mvkoe is offline   0 Reply With Quote
Old Feb 4, 2013, 11:35 AM   #11
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
Well, I don't think there's an algorithm for this, so you'll probably need a lookup table of some kind.
__________________
dejo is offline   0 Reply With Quote
Old Feb 4, 2013, 11:41 AM   #12
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Quote:
Originally Posted by dejo View Post
Well, I don't think there's an algorithm for this, so you'll probably need a lookup table of some kind.
I agree: you will have to have a lookup of values and an algorithm to decide which is "closest". I would note that the simplistic option of calculating absolute difference of the 3 components and adding them together then selecting the smallest difference may not result in the answer you would expect: visual difference of colours is a complex task and not an easy one to automate...
robbieduncan is offline   0 Reply With Quote
Old Feb 4, 2013, 05:51 PM   #13
xArtx
macrumors 6502a
 
Join Date: Mar 2012
Some pixels from the camera are dud, and don't agree with the
pixels adjacent to it sometimes,
even if the whole scene is close to one colour.

You need to look at the value of five or so pixels and calculate
their mean average.

---

Put all of the hex values from the link you provided in a lookup table,
and all of their English names in another array in the same order.
Create an empty integer array with the same number of elements
as there are colours in the table.
Get the mean average of a few pixels from the camera, that's the input colour.

Calculate the total deviation of all three colour components of the first colour
value in the lookup table, and store the total deviation across all three colour
components in the first index of the integer array.
Do this for the entire colour table.
Find the integer array element with the lowest value.
The colour name in English that has the same index is the closest colour with
a name in English.

Bear in mind the end of the answer above. The solution is rough.

Last edited by xArtx; Feb 4, 2013 at 06:04 PM.
xArtx is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Naming a new iMac? How is it used? stanw iMac 4 Jul 30, 2013 04:19 PM
Naming OS XI: Possible Naming Scheme ShaneG235711 OS X 10.8 Mountain Lion 1 Feb 7, 2013 09:50 PM
Naming My Apple TV Michael73 Apple TV and Home Theater 10 Jan 17, 2013 05:21 PM
Naming the NEW New iPad :P zauze iPad 53 Oct 23, 2012 09:20 AM
Apple's Color Labs Acquisition Involves Only Color's Engineering Team MacRumors MacRumors.com News Discussion 44 Oct 22, 2012 11:40 AM

Forum Jump

All times are GMT -5. The time now is 01:01 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC