def str_to_rgba(hex_): """Translate color from hex string to Gdk.RGBA""" purehex = hex_.lstrip("#") nums = [int(purehex[i:i + 2], 16) / 255.0 for i in range(0, 7, 2)] return Gdk.RGBA(*nums)