In the general forum got nno answer hope you can really help me out! (Desperate)

Here i go:

I'm writting a program that has a form with many random colors in a picture box!

What i m trying to accomplish is to after the user clicks on a color the program tells wich color that is and if its light or dark color!

Thing is there are millions of colors, so i would like to write a function to help me out!

I thing that if i use the HSL i can know wich color it is but i dont know how since i couldn't find a proportion with the rgb values, like if Red > 100 and blue < 200 = something!

I know how to get the long and convert it to RGB values but i'm looking to find a relation, see? U think HSL is a possible one?

PLease give me some hints!

Thanks!!!!