def rgba_to_str(rgba): """Translate color from Gdk.RGBA to hex format""" return "#%02X%02X%02X%02X" % tuple(int(getattr(rgba, name) * 255) for name in ("red", "green", "blue", "alpha"))