********* wx.Colour ********* Inheritance diagram for `wx.Colour`: | .. inheritance-diagram:: wx.Colour | Description =========== A colour is an object representing a combination of Red, Green, and Blue (RGB) intensity values, and is used to determine drawing colours. See the entry for `wx.ColourDatabase `_ for how a pointer to a predefined, named colour may be returned instead of creating a new colour. Valid RGB values are in the range 0 to 255. You can retrieve the current system colour settings with `wx.SystemSettings `_. .. seealso:: `wx.ColourDatabase `_, `wx.Pen `_, `wx.Brush `_, `wx.ColourDialog `_, `wx.SystemSettings `_ Derived From ^^^^^^^^^^^^^ * `wx.Object `_ Known Subclasses ^^^^^^^^^^^^^^^^ `wx.Color `_ Methods Summary ^^^^^^^^^^^^^^^ * `__init__ <#__init__>`_ * `Alpha <#Alpha>`_ * `Blue <#Blue>`_ * `Get <#Get>`_ * `GetAsString <#GetAsString>`_ * `GetPixel <#GetPixel>`_ * `GetRGB <#GetRGB>`_ * `Green <#Green>`_ * `IsOk <#IsOk>`_ * `Ok <#Ok>`_ * `Red <#Red>`_ * `Set <#Set>`_ Properties Summary ^^^^^^^^^^^^^^^^^^ * `Pixel <#Pixel>`_ * `RGB <#RGB>`_ Class API ========= Methods ^^^^^^^ .. method:: __init__(red=0, green=0, blue=0, alpha=wx.ALPHA_OPAQUE) Constructs a colour from red, green, blue and alpha values. **Parameters:** * `red` (byte) * `green` (byte) * `blue` (byte) * `alpha` (byte) | **Returns:** `wx.Colour `_ ---------------- .. method:: Alpha() Returns the alpha value, on platforms where alpha is not yet supported, this always returns ``wx.ALPHA_OPAQUE``. | **Returns:** `int` ---------------- .. method:: Blue() Returns the blue intensity. | **Returns:** `int` ---------------- .. method:: Get(includeAlpha=False) Returns the RGB intensity values as a tuple, optionally the alpha value as well. **Parameters:** * `includeAlpha` (bool): whether to include the alpha bit in the output or not. | **Returns:** `(r, g, b)` **or** `(r, g, b, a)` ---------------- .. method:: GetAsString(flags=wx.C2S_NAME|wx.C2S_CSS_SYNTAX) Returns the colour as a string. **Parameters:** * `flags` (bool): Acceptable flags are: ====================== ===================================== ``wx.C2S_NAME`` Returns colour name, when possible ``wx.C2S_CSS_SYNTAX`` Returns colour in rgb(r, g, b) syntax ``wx.C2S_HTML_SYNTAX`` Returns colour in #rrggbb syntax ====================== ===================================== | **Returns:** `string` ---------------- .. method:: GetPixel() Returns a pixel value which is platform-dependent. On Windows, a ``COLORREF`` is returned. On X, an allocated pixel value is returned. -1 is returned if the pixel is invalid (on X, unallocated). | **Returns:** `int` ---------------- .. method:: GetRGB() Returns the RGB intensity values as a tuple. | **Returns:** `(r, g, b)` ---------------- .. method:: Green() Returns the green intensity. | **Returns:** `int` ---------------- .. method:: IsOk() Returns ``True`` if the colour object is valid (the colour has been initialised with RGB values). | **Returns:** `int` ---------------- .. method:: Ok() Synonim for `IsOk <#IsOk>`_. Returns ``True`` if the colour object is valid (the colour has been initialised with RGB values). | **Returns:** `int` ---------------- .. method:: Red() Returns the red intensity. | **Returns:** `int` ---------------- .. method:: Set(red, green, blue, alpha=wx.ALPHA_OPAQUE) Sets the RGB intensity values. **Parameters:** * `red` (int): The red intensity. * `green` (int): The green intensity. * `blue` (int): The blue intensity. * `alpha` (int): The alpha bit. ---------------- .. method:: SetFromName(colourName) Sets the RGB intensity values using a colour name listed in `wx.TheColourDatabase`. **Parameters:** * `colourName` (string): The colour name. ---------------- .. method:: SetRGB(colRGB) Sets the RGB intensity values from a packed RGB value. **Parameters:** * `colRGB` (tuple): The packed RGB values. -------- Properties ^^^^^^^^^^ .. attribute:: Pixel See `GetPixel <#GetPixel>`_ .. attribute:: RGB See `GetRGB <#GetRGB>`_ and `SetRGB <#SetRGB>`_