List available color spaces

Color spaces available in texture nodes depend on the OpenColorIO configuration of the user. Is there a clean way to list them? So far I’ve been using this terrible hack:

def listAvailableColorSpaces(image):
    # Warning: hack ahead
    try: = ''
    except TypeError as e:
        s = str(e)
    return eval(s[s.find('('):])

bl_rna should be of help here:



0 <bpy_struct, EnumPropertyItem("Filmic Log")>
1 <bpy_struct, EnumPropertyItem("Linear")>
2 <bpy_struct, EnumPropertyItem("Linear ACES")>
3 <bpy_struct, EnumPropertyItem("Non-Color")>
4 <bpy_struct, EnumPropertyItem("Raw")>
5 <bpy_struct, EnumPropertyItem("sRGB")>
6 <bpy_struct, EnumPropertyItem("XYZ")>

Great, thanks, I must admit I’m not used to dive into the raw bl_rna attribute!