I noticed I can get/set an icon for a document type on IContentType.Icon, but I haven't seen how to get the icon color yet. The color being specified in this interface:
Here's an example of the code to get an icon:
// I can get an icon, but not sure how to get the icon color.
var icon = ApplicationContext.Services.ContentTypeService.GetAllContentTypes().First().Icon;
I have already confirmed that the icon color is not a class stored in the Icon property.
In your example, what does the Icon property return? It actually should contain both the class name for the icon it self and the class name for the color. Although, as black is the default color, it's not included in the value if the selected color is black.
So for instance, if you have selected the house icon and chosen a black color, the saved value will be icon-home.
If you instead choose blue as the color, the saved value will be icon-home color-blue.
Programmatically Get/Set Document Type Icon Color
I noticed I can get/set an icon for a document type on
IContentType.Icon
, but I haven't seen how to get the icon color yet. The color being specified in this interface:Here's an example of the code to get an icon:
I have already confirmed that the icon color is not a class stored in the
Icon
property.Have you found a way to set it programmatically?
In your example, what does the
Icon
property return? It actually should contain both the class name for the icon it self and the class name for the color. Although, as black is the default color, it's not included in the value if the selected color is black.So for instance, if you have selected the house icon and chosen a black color, the saved value will be
icon-home
.If you instead choose blue as the color, the saved value will be
icon-home color-blue
.You can see the supported colors here:
https://github.com/umbraco/Umbraco-CMS/blob/2bb5d0b30eee2f4016b8b48034cb7ec717da66a9/src/Umbraco.Web.UI.Client/src/views/common/overlays/iconpicker/iconpicker.controller.js#L14
Hope that helps ;)
is working on a reply...