Can I get the name of a named ColorGroup?

Is there any way to get the name of a named ColorGroup after it’s been created? I don’t see anything in the docs that indicates that you can…

I want to be able to save and restore ColorGroups using a database. I know I can get the colors from a named group using cg.Values, but if it’s a named group I’d rather save the name.

classname:

var etype As Introspection.TypeInfo = Introspection.GetType(MyColorGroup)

var name as string = etype.name // use .fullName if you need also module name.

The name var now contains “MyColorGroup” as a string

I guess my subject line was a little vague. I want to get the name of the named color, not the name of the ColorGroup.

Seems you should handle this a bit differently - best approach is probably to have a dictionary of color groups where the keys are string names and values are the color groups themselves. Then you can iterate over the keys of the dictionary to get all color names and do a name to color group lookup easily.

another option is to have a class with a color group and a name property and then manage access through that class. That way the data is always tied together

1 Like

I was starting to think along those lines too. Subclass ColorGroup and add a NamedColor property. It’s really an edge case that I don’t have any need for, so I’ll probably just not worry about it for now.

Ooh, not sure if that’s possible