Attribute In C# For The Inspector Icon Of My Component

I wish to add an Icon to my script in the same way as

 [AddComponentMenu("Miscellaneous/MyScript")]

Is it possible to use an attribute?
like for example:

  • [AddIcon(“Assets/Textures/ColorIcon.png”)]

You can change the script icon through the inspector if you select the script, but you cannot change it through code.
https://docs.unity3d.com/Manual/AssigningIcons.html