What is the optimum way (least processor intensive) to retrieve the string that is associated with one of a set (array) of non-contiguous integer values?
The situation is this: I'm implenting a color-of-screenpixel function in one of my applications and I want to display the html hex value <unless> it matches one of the set of named HTML colors. There are 147 of them as of now - for example here are the first 16 in the list: (Note this is snipped from a web page and I've not "delphized" the numeric values yet.)
I could put them into a structure of Int for the hex value, string for the name and loop through the structure array and look for the interger value match. But maybe there's a better, faster way. This function will be inside of a fast timer and get hit everytime the cursor position changes.