I found a couple of colour cubes... http://www.alphabetsystems.com/color/netcubes/color40.htm http://fourier.eng.hmc.edu/e161/lectures/color_processing/node1.html
John ----- Original Message ----- From: "Mark Winterhalder" <[EMAIL PROTECTED]> To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com> Sent: Tuesday, October 31, 2006 2:12 PM Subject: Re: [Flashcoders] Comparing HEX > > I suspect you already know this, so I am wondering if your method actually > > works quite well as a first approximation. > > It's been a few years since when I researched color spaces and I > haven't done anything with them since, so I could well be wrong. I > guess it would work as a very simple test to see if two colors are > approximately similar, but I also like that idea with the cube you > wrote about. > > It sounds like it is still RGB. So, the distance in the cube could be > calculated as: > var dist = Math.sqrt( Math.pow( red1 - red2, 2 ) + Math.pow( green1 - > green2, 2 ) + Math.pow( blue1 - blue2, 2 ) ); > > Sorry, must run -- a friend is waiting in the car downstairs... > Maybe I'll look into it later, colors are interesting. Last time, I > couldn't find a transformation from various colorspaces to CIE XYZ, > back and forth. Does anybody have some links? > > Mark > > > On 10/31/06, John McCormack <[EMAIL PROTECTED]> wrote: > > Mark, > > That's a facinating article in wikipedia but I don't know if I can ever > > understand it. One will try! > > > > In a book called Bitmapped Graphics Programming in C++ by Luse, there is a > > colour cube model which is helpful. The colour differences you calculate > > below are complicated by the question "If I minimize one colour component, > > could I not get closer by minimizing another?". > > > > In that model each colour is a linear distance along an axis, making a > > colour cube in 3d space. Grey (colours 128,128,128 or hex 0x7f7f7f) is in > > the centre. They grey line runs diagonally out from the origin, getting > > lighter as you move out. Choose a colour in that cube and the clossness of > > any other available colour can be found by using your distances, squaring > > them and finding out which one is the least 3d distance from the desired > > point. > > > > I suspect you already know this, so I am wondering if your method actually > > works quite well as a first approximation. > > > > John > > > > > > ----- Original Message ----- > > From: "Mark Winterhalder" <[EMAIL PROTECTED]> > > To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com> > > Sent: Monday, October 30, 2006 11:35 PM > > Subject: Re: [Flashcoders] Comparing HEX > > > > > > > > What would be the best way to loop the array and find the best match to > > > > myColor? > > > > > > A simple way would be do add up the difference to the red, green and > > > blue values. > > > You get the value for the channels like this: > > > > > > var red = color >> 16 & 0xff; > > > var green = color >> 8 & 0xff; > > > var blue = color & 0xff; > > > > > > Then you can do a Math.abs( red1 - red2 ) + Math.abs( green1 - green2 > > > ) + Math.abs( blue1 - blue2 ) and you get the total difference between > > > two colors. > > > > > > This isn't the most exact way to measure the distance between two > > > colors as perceived by an average human being, but if you want to > > > really know that perceived distance, then RGB isn't the right color > > > space and it gets a bit more complicated: > > > <http://en.wikipedia.org/wiki/Lab_color_space> > > > > > > HTH, > > > Mark > > > > > > > > > > > > On 10/31/06, Aaron Buchanan <[EMAIL PROTECTED]> wrote: > > > > Hello all! > > > > > > > > I am looking for a reference to read up on comparing two or more color > > > > values. I have not done a whole lot of work with color math so any > > > > foundation articles would be great. > > > > > > > > What I am trying to accomplish, say I have a var "myColor" which > > represents > > > > the color I would like to find the closest match for, I also have an > > array > > > > of other colors that are all shades of yellow: > > > > > > > > -- > > > > > > > > var myColor:Number = 0xffcc00 > > > > var similarColors:Array = [ 0xfce427, 0xdcb30a, 0xa48611]; > > > > > > > > -- > > > > > > > > What would be the best way to loop the array and find the best match to > > > > myColor? > > > > > > > > Thanks in Advance! > > > > > > > > -- > > > > Aaron Buchanan | Flash Developer, Lab-Media | T 909 702 1368 > > > > > > > > > > > > _______________________________________________ > > > > Flashcoders@chattyfig.figleaf.com > > > > To change your subscription options or search the archive: > > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > > > Brought to you by Fig Leaf Software > > > > Premier Authorized Adobe Consulting and Training > > > > http://www.figleaf.com > > > > http://training.figleaf.com > > > > > > > _______________________________________________ > > > Flashcoders@chattyfig.figleaf.com > > > To change your subscription options or search the archive: > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > Brought to you by Fig Leaf Software > > > Premier Authorized Adobe Consulting and Training > > > http://www.figleaf.com > > > http://training.figleaf.com > > > > > > > > > _______________________________________________ > > Flashcoders@chattyfig.figleaf.com > > To change your subscription options or search the archive: > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > Brought to you by Fig Leaf Software > > Premier Authorized Adobe Consulting and Training > > http://www.figleaf.com > > http://training.figleaf.com > > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com