2
$\begingroup$

I’m trying to set a color tag to a collection with Python by using the collection name. How can I do that ?

Have a nice coding day !

enter image description here

$\endgroup$

1 Answer 1

3
$\begingroup$

Collection.color_tag

Set one of the pre-designated colors using the color_tag ENUM

>>> C.collection.color_tag
'NONE'

Consult the docs, or crunch in an incorrect value to get the list of valid values

>>> C.collection.color_tag = 'FOO'
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
TypeError: bpy_struct: item.attr = val: enum "FOO" not found in ('NONE', 'COLOR_01', 'COLOR_02', 'COLOR_03', 'COLOR_04', 'COLOR_05', 'COLOR_06', 'COLOR_07', 'COLOR_08')

Set it to red,

>>> C.collection.color_tag = 'COLOR_01'
>>> 
$\endgroup$
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .