This was a hot topic for some time in the late 1960's and early 1970's I think, with academic books like "The Luscher Color Test" (Luscher & Scott, 1971) being published. The Luscher Color Test being a personality test based entirely on color preference. This is probably what current online personality tests that use color preference are based on, but most of this old literature is not very easy to access.
More recent research by Rense Lange and Jason Rentfrow (2007) indicates that there is definitely a correlation between color preference and personality traits when you look at a large group of people. To some extent, it is possible to actually predict personality traits from color preference. Regarding color preference and the Sixteen Personality Factor questionnaire, Lange and Rentfrow state:
respondents’ color preferences provide powerful
predictors of their personalities. The highest correlation is obtained for
Factor H (Social Boldness).
So there is definitely some truth to the idea, but using only color preference is not optimal when trying to predict personality traits. It would be of more value as one predictor in a larger set of predictors, when trying to predict a person's personality somewhat accurately.
For more on this subject, see Color and Personality: Strong's Interest Inventory and Cattell's 16PF