I'm new and I'm trying to learn how to make a toggle for the alpha channel of of the viewport display material so that I can set a shortcut on it. I can't do that by normal means it seems. So I'm trying to make a script for it. I already know how to make an addon. I know how to do something like this in Maya but I can't figure it out here in Blender!
What would be the line of code I should use to make this happen? I'd like to toggle between a value of 0.2 and 1 with the said command.
This is the attribute in question:
bpy.context.object.active_material.diffuse_color[3]
Thanks!