def color_to_hex(name):
    """Convert a named ReportLab color (Color class) to a hexadecimal string"""
    _tuple = (int(name.red*255), int(name.green*255), int(name.blue*255))
    _string = '#%02x%02x%02x' % _tuple
    return _string.upper()