style = (
    """background-color: rgb(221, 81, 76); background-image: -moz-linear-gradient(center top , rgb(238, 95, 91), rgb(196, 60, 53)); background-repeat: repeat-x; color: rgb(255, 255, 255); width: 11.5%;"""
    )
r, g, b = map(int, re.search(
    'background-color: rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)', style).groups())
print('{:X}{:X}{:X}'.format(r, g, b))
How to get a color of a web element using Selenium WebDriver with python?