The user of the ASP.NET web app I'm building can select colors for use on some of the elements (e.g. buttons/titles) to facilitate some degree of personalisation.
The problem is that by default the text on those layers is black...what I'm trying to do is to evaluate the HEX value chosen by the user through a picker, and switch between black and white text programmatically - this can be in JavaScript, or in code behind.
The crux of the problem is that I'm just not sure how to evaluate the HEX to make the decision whether the proximity of the chosen color to black is too close to use black text.
Any ideas?