def chooseBgColor(self, currentBg): r, g, b = currentBg or (255, 255, 255) dlg = win32ui.CreateColorDialog(win32api.RGB(r, g, b), win32con.CC_ANYCOLOR, self.__window) if dlg.DoModal() == win32con.IDOK: newcol = dlg.GetColor() rgb = win32ui.GetWin32Sdk().GetRGBValues(newcol) return rgb return None
def OnButThisBackground(self, id, code): if code==win32con.BN_CLICKED: style = self.GetSelectedStyle() bg = win32api.RGB(0xff, 0xff, 0xff) if style.background != CLR_INVALID: bg = style.background d=win32ui.CreateColorDialog(bg, 0, self) if d.DoModal()==win32con.IDOK: style.background = d.GetColor() self.scintilla.ApplyFormattingStyles(0) return 1
def OnButEdgeColor(self, id, code): if code == win32con.BN_CLICKED: d = win32ui.CreateColorDialog(self.edgeColor, 0, self) # Ensure the current color is a custom color (as it may not be in the swatch) # plus some other nice gray scales. ccs = [self.edgeColor] for c in range(0xef, 0x4f, -0x10): ccs.append(win32api.RGB(c,c,c)) d.SetCustomColors( ccs ) if d.DoModal() == win32con.IDOK: self.edgeColor = d.GetColor() self.UpdateUIForState()