Click here to Skip to main content
12,826,135 members (31,994 online)
Click here to Skip to main content
Alternatives (4)
Add your own
alternative version

Tagged as


14 bookmarked
Posted 13 Sep 2011

Random Color Generator

, 17 Jun 2014 CPOL


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

5 Oct 2011
15 Sep 2011
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
2 Oct 2011
Anshul R
Rnd() For Red, Green, Blue values. Then convert to ARGB.
5 Oct 2011
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 get a correct codethe calculation is more precise with the expanded...


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


About the Author

Eric Ouellet
Software Developer
Canada Canada

I'm a Canadian-french developer for many years now.
I'm actually programming in C# but I also had some fun in the past with: VB, C++, SQL, Java, etc.
I like to play games like Carcassone, Settlers of Catane, Chess, Poker...
I also like photography.


| | Privacy | Terms of Use | Mobile
Web01 | 2.8.170326.1 | Last Updated 17 Jun 2014
Article Copyright 2011 by Eric Ouellet
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid