Phoenix Logo

phoenix_title wx.lib.colourutils

Some useful colour-related utility functions.

function_summary Functions Summary

AdjustAlpha Adjust the alpha of a given colour
AdjustColour Brighten/darken input colour by percent and adjust alpha
BestLabelColour Get the best color to use for the label that will be drawn on
GetHighlightColour Gets the default highlight color.

Functions



AdjustAlpha(colour, alpha)

Adjust the alpha of a given colour

Parameters:alpha (integer) – the new value for the colour alpha channel (between 0 and 255).
Return type:wx.Colour
Returns:A new wx.Colour with the alpha channel specified as input


AdjustColour(color, percent, alpha=wx.ALPHA_OPAQUE)

Brighten/darken input colour by percent and adjust alpha channel if needed. Returns the modified color.

Parameters:
  • color (wx.Colour) – color object to adjust;
  • percent (integer) – percent to adjust +(brighten) or -(darken);
  • alpha (integer) – amount to adjust alpha channel.
Return type:

wx.Colour

Returns:

A new darkened/lightened wx.Colour with the alpha channel specified as input



BestLabelColour(color, bw=False)

Get the best color to use for the label that will be drawn on top of the given color.

Parameters:
  • color (wx.Colour) – background color that text will be drawn on;
  • bw (bool) – If True, only return black or white.
Return type:

wx.Colour



GetHighlightColour()

Gets the default highlight color.

Return type:wx.Colour