Home |
Search |
Today's Posts |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Charlotte E." wrote in message I stumbled across this nice one: http://gauth.fr/2011/09/get-a-color-...b-combination/ Very neat indeed :-) But made in JavaScript, which I know virtual nothing about... I was wondering, if anyone has made something similar in VBA? Can it be done? How? I did but it was a long time ago. At the time I couldn't find any examples had despite extensive searching. Originally it was VBA but I put it in a VB6 ComAddin, a colour match tool as a small feature of a much larger range of colour related stuff for Excel. Briefly this is "how" to go about it. First you need a swatch of defined and optionally "named" RGB colours to match against, your example seems to be using this list of named and defined colours - http://gauth.fr/2011/09/get-a-color-...b-combination/ But there are others, not least the well known swatch (1100+ colours) from a certain print ink producer, or say the 140 named html colours. The hard bit is to define a virtual "colour space" that reflects the very different way the human eye perceives colour differences vs the actual RGB differences. Eg the eye perceives green as occupying a much larger relative space than its neighbour in the spectrum cyan. There are various example spaces out there but replicating them is difficult. I gave up and devised my own colour space as a semi regular 3D space, complex but regular enough to be defined with an algorithm. Then map all the colours in the list in the space with XYZ coordinates from a given reference point, and similar with the RGB you want to match. Finally the simple bit, calculate all the 3d distances of your colour to match to each of the mapped swatch colours. The best match is the one with the shortest distance in the space, though in a large swatch a good idea to return and rank a few other close matches and let your own eye judge the best. And that's all there is to it! Regards, Peter T |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
custom color for font color and or background shading color | Excel Programming | |||
combination | Excel Discussion (Misc queries) | |||
Combination | Charts and Charting in Excel | |||
combination | Excel Programming | |||
combination | Excel Programming |