Phoenix Logo

phoenix_title wx.ColourDatabase

wxWidgets maintains a database of standard RGB colours for a predefined set of named colours.

The application may add to this set if desired by using AddColour and may use it to look up colours by names using Find or find the names for the standard colour using FindName.

There is one predefined, global instance of this class called wx.TheColourDatabase .

The standard database contains at least the following colours:

AQUAMARINE FIREBRICK MEDIUM FOREST GREEN RED
BLACK FOREST GREEN MEDIUM GOLDENROD SALMON
BLUE GOLD MEDIUM ORCHID SEA GREEN
BLUE VIOLET GOLDENROD MEDIUM SEA GREEN SIENNA
BROWN GREY MEDIUM SLATE BLUE SKY BLUE
CADET BLUE GREEN MEDIUM SPRING GREEN SLATE BLUE
CORAL GREEN YELLOW MEDIUM TURQUOISE SPRING GREEN
CORNFLOWER BLUE INDIAN RED MEDIUM VIOLET RED STEEL BLUE
CYAN KHAKI MIDNIGHT BLUE TAN
DARK GREY LIGHT BLUE NAVY THISTLE
DARK GREEN LIGHT GREY ORANGE TURQUOISE
DARK OLIVE GREEN LIGHT STEEL BLUE ORANGE RED VIOLET
DARK ORCHID LIME GREEN ORCHID VIOLET RED
DARK SLATE BLUE MAGENTA PALE GREEN WHEAT
DARK SLATE GREY MAROON PINK WHITE
DARK TURQUOISE MEDIUM AQUAMARINE PLUM YELLOW
DIM GREY MEDIUM BLUE PURPLE YELLOW GREEN

See also

wx.Colour


class_hierarchy Class Hierarchy

Inheritance diagram for class ColourDatabase:

method_summary Methods Summary

__init__ Constructs the colour database.
AddColour Adds a colour to the database.
Find Finds a colour given the name.
FindColour  
FindName Finds a colour name given the colour.

api Class API



class wx.ColourDatabase(object)

Possible constructors:

ColourDatabase()

wxWidgets maintains a database of standard RGB colours for a predefined set of named colours.


Methods



__init__(self)

Constructs the colour database.

It will be initialized at the first use.



AddColour(self, colourName, colour)

Adds a colour to the database.

If a colour with the same name already exists, it is replaced.

Parameters:
  • colourName (string) –
  • colour (wx.Colour) –


Find(self, colourName)

Finds a colour given the name.

Returns an invalid colour object (that is, wx.Colour.IsOk will return False) if the colour wasn’t found in the database.

Parameters:colourName (string) –
Return type: wx.Colour


FindColour(self, colour)


FindName(self, colour)

Finds a colour name given the colour.

Returns an empty string if the colour is not found in the database.

Parameters:colour (wx.Colour) –
Return type:string