Click here to Skip to main content
15,886,110 members
Articles / Programming Languages / C#

Random Color Generator

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
2 Oct 2011CPOL 10.1K  
Rnd() For Red, Green, Blue values. Then convert to ARGB.

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
5 Oct 2011Rob2412
Eric,Thank...
Please Sign up or sign in to vote.
17 Jun 2014Eric Ouellet 4 alternatives  
Please Sign up or sign in to vote.
15 Sep 2011flector
Easy HTML random color generator code (in C++):srand (time(NULL));TCHAR rand_color[10];wsprintf (rand_color, L"#%02x%02x%02x", rand()%255, rand()%255, rand()%255);//rand_color is now a random html color code in text
Please Sign up or sign in to vote.
5 Oct 2011Rob2412
Eric, sorry for the confusion, I think I wrote it too quick:Guillaume's library uses sRGB with D65 white ref. If you want to continue using that conversion, then just copy/paste RGBtoXYZ and XYZtoRGB into your code.you get a correct codethe calculation is more precise with the expanded...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Student
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions