MCPcopy Create free account
hub / github.com/CobaltFusion/DebugViewPP / GetRandomColor

Function GetRandomColor

DebugView++Lib/Colors.cpp:48–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48COLORREF GetRandomColor(double s, double v)
49{
50 static bool randomize = (std::srand(GetTickCount()), true);
51 static const double ratio = (1 + std::sqrt(5.))/2 - 1;
52 // use golden ratio
53 static double h = static_cast<double>(std::rand()) / (RAND_MAX + 1);
54
55 h += ratio;
56 if (h >= 1)
57 h = h - 1;
58 return HsvToRgb(h, s, v);
59}
60
61COLORREF GetRandomBackColor()
62{

Callers 3

GetRandomBackColorFunction · 0.85
GetRandomTextColorFunction · 0.85
GetRandomProcessColorFunction · 0.85

Calls 1

HsvToRgbFunction · 0.85

Tested by

no test coverage detected