[wxPython-users] Orange in Windows isn't very orange

Robin Dunn robin at alldunn.com
Mon Mar 3 11:18:17 PST 2008


Chris Carlen wrote:
> Hi:
> 
>  >>> wx.NamedColour("Orange")
> wx.Colour(204, 50, 50, 255)
> 
> Yeah right, like that's orange?
> 
> In Linux:
> 
> wx.NamedColor("Orange")
> wx.Colour(255, 165, 0, 255)
> 
> That's better.
> 
> What's with "Orange" in Windoze?

The color names/values built-in to wxWidgets are ones that have been 
there forever and some do have poorly chosen values.  On wxGTK the 
built-in names/values are overridden and extended by those in the 
rgb.txt file that is part of the X-Windows install on the system, which 
is a larger and more up to date set of colors.

In the wxPython library there is a module that can extend the wx named 
colours table with a similar set of colors as rbg.txt.  You just need to 
import it and initialize it somewhere in your startup code, like this:

	import wx.lib.colourdb
	wx.lib.colourdb..updateColourDB()


  >>> import wx
  >>> wx.NamedColor("orange")
  wx.Colour(204, 50, 50, 255)
  >>> import wx.lib.colourdb as cd
  >>> cd.updateColourDB()
  >>> wx.NamedColor("orange")
  wx.Colour(255, 165, 0, 255)




-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list