.. include:: headings.inc .. _ColourDatabase: ========================================================================================================================================== |phoenix_title| **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 :meth:`~ColourDatabase.AddColour` and may use it to look up colours by names using :meth:`~ColourDatabase.Find` or find the names for the standard colour using :meth:`~ColourDatabase.FindName`. There is one predefined, global instance of this class called ``TheColourDatabase`` The standard database contains at least the following colours: .. include:: E:\Phoenix\wxPython\Phoenix\docs\sphinx\rest_substitutions\tables\ColourDatabase.1.rst .. seealso:: :ref:`Colour` | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **ColourDatabase** .. raw:: html

Inheritance diagram of ColourDatabase

| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~ColourDatabase.__init__` Constructs the colour database. :meth:`~ColourDatabase.AddColour` Adds a colour to the database. :meth:`~ColourDatabase.Find` Finds a colour given the name. :meth:`~ColourDatabase.FindColour` :meth:`~ColourDatabase.FindName` Finds a colour name given the colour. ================================================================================ ================================================================================ | |api| Class API =============== .. class:: ColourDatabase(object) wxWidgets maintains a database of standard ``RGB`` colours for a predefined set of named colours. **Possible constructors**:: ColourDatabase() .. method:: __init__(self) Constructs the colour database. It will be initialized at the first use. .. method:: AddColour(self, colourName, colour) Adds a colour to the database. If a colour with the same name already exists, it is replaced. :param `colourName`: :type `colourName`: string :param `colour`: :type `colour`: Colour .. method:: Find(self, colourName) Finds a colour given the name. Returns an invalid colour object (that is, :meth:`Colour.IsOk` will return ``False``) if the colour wasn't found in the database. :param `colourName`: :type `colourName`: string :rtype: :ref:`Colour` .. method:: FindColour(self, colour) .. method:: FindName(self, colour) Finds a colour name given the colour. Returns an empty string if the colour is not found in the database. :param `colour`: :type `colour`: Colour :rtype: `string`