In theory, yes. In fact, calculating the closest color is nontrivial if you want to do it well. For example, people's eyes are much more sensitive to changes in brightness than color shifts, especially to the ends of the color range (i.e., towards the extreme red or blue).
At least if you don't mind doing any extra work in the calculation, you will want to use one of the standard “delta E” calculations (in your case, you want to minimize delta E). Please note that all (everything I worked with anyway) work in the CIE Lab * color space. Typically, you will start with RGB, which you will need to convert to Lab * first .
source
share