- faceClr = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE)
- textClr = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNTEXT)
- self.faceDnClr = faceClr
- self.SetBackgroundColour(faceClr)
- self.SetForegroundColour(textClr)
-
- shadowClr = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNSHADOW)
- highlightClr = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNHIGHLIGHT)
- self.shadowPen = wx.Pen(shadowClr, 1, wx.SOLID)
- self.highlightPen = wx.Pen(highlightClr, 1, wx.SOLID)
+ """
+ Calculate a new set of highlight and shadow colours based on
+ the background colour. Works okay if the colour is dark...
+ """
+ faceClr = self.GetBackgroundColour()
+ r, g, b = faceClr.Get()
+ fr, fg, fb = min(255,r+32), min(255,g+32), min(255,b+32)
+ self.faceDnClr = wx.Colour(fr, fg, fb)
+ sr, sg, sb = max(0,r-32), max(0,g-32), max(0,b-32)
+ self.shadowPen = wx.Pen(wx.Colour(sr,sg,sb), 1, wx.SOLID)
+ hr, hg, hb = min(255,r+64), min(255,g+64), min(255,b+64)
+ self.highlightPen = wx.Pen(wx.Colour(hr,hg,hb), 1, wx.SOLID)
+ self.focusClr = wx.Colour(hr, hg, hb)
+
+ textClr = self.GetForegroundColour()