Check the icon's type before using the icon_alpha theme property.
Custom icons are indeed an issue. Matcaps and such use ICON_TYPE_BUFFER, other previews like material previews use ICON_TYPE_PREVIEW. However ICON_TYPE_PREVIEW is also used for custom icons (should maybe be mentioned in a comment at its definition). So we can't just rely on that currently.
I think there could just be a bool use_theme_icon_alpha passed to icon_create() and stored in Icon. That gives better control and seems generally a bit nicer, since the option is controlled at a higher level.
Another issue is that custom icons are used for both, regular icons, as well as custom previews. So we'd need the information on how the icon is used to know if we should apply the alpha. For now I'd say just always apply the alpha for custom icons. If needed we can let the Python API have more control.
Event icons may be mixed with other icons, so we should apply alpha for them too, otherwise:
Note that this is already an issue in master, but that's separate. So I'd just add ICON_TYPE_EVENT here.
That wouldn't be the end of the world... but I actually like that feature...
I got a quite dark custom theme and (depending on the mood hehehe) sometimes I feel like the icons are in the way.... so be able to adjust the opacity of all the icons at same time with just one slider was kinda neat....
I'm not particularly attached to keeping the feature, it's not important. It's still convenient somewhat, so we might as well keep it and not break API/theme compatibility?
However ICON_TYPE_PREVIEW is also used for custom icons (should maybe be mentioned in a comment at its definition). So we can't just rely on that currently.
I'm not sure how deep this goes, but using a different ICON_TYPE for custom icons would be good then, since using ICON_TYPE_PREVIEW makes little sense.
Okay, I looked at this again. The issue with this patch is that it affect's custom icons too.
The relationship between custom icons a does indeed go pretty deep-- as far as I can tell, they ARE previews.
So there is no way to differentiate between the two without exposing some new parameter to python, where both can be created.
I'd like a test case before I work on this though. Do you know of an addon included in Blender that uses custom icons?
Well, this icon_alpha does not applied to the big Alert icon.
In the File Browser, it is not applied to the large folder icon (thumbnails mode) but it does to small ones (list mode).
It not applied to the EVENT and the VECTOR (key type, handle type) icons.
But it is applied where it is not expected...
For me, icon_alpha option only makes sense for GEOM toolbar icons, together with the Icon Saturation.
Also, for example, if the addon uses custom icons, they do not respect the text color from the theme
as internal ones do, so they are likely to be different anyway.