How to set color tags to collection with Python?

Hi everybody,

I’m trying to set a color tag to a collection with Python, How can I do that ?

Have a nice coding day !

bpy.data.collections[0].color_tag = "COLOR_08"

valid options:
'NONE', 'COLOR_01', 'COLOR_02', 'COLOR_03', 'COLOR_04', 'COLOR_05', 'COLOR_06', 'COLOR_07', 'COLOR_08'

2 Likes

Thanks ! How can I use the collection name instead of collection index ?

Actually, it was simple :

bpy.data.collections['myCollectionName'].color_tag = "COLOR_01"