+// StepColour() it a utility function that simply darkens
+// or lightens a color, based on the specified percentage
+static wxColor StepColour(const wxColor& c, int percent)
+{
+ int r = c.Red(), g = c.Green(), b = c.Blue();
+ return wxColour((unsigned char)wxMin((r*percent)/100,255),
+ (unsigned char)wxMin((g*percent)/100,255),
+ (unsigned char)wxMin((b*percent)/100,255));
+}
+
+static wxColor LightContrastColour(const wxColour& c)
+{
+ int amount = 120;
+
+ // if the color is especially dark, then
+ // make the contrast even lighter
+ if (c.Red() < 128 && c.Green() < 128 && c.Blue() < 128)
+ amount = 160;
+
+ return StepColour(c, amount);
+}
+