How to set in a panel ThemeGradientColors.show_grad using python


I want add the option to enable or disable the gradient in 3dView to a panel to avoid open User preferences each time.

I have seen that the property is: ThemeGradientColors.show_grad=True/False

I have tried in the following context, but I cannot get this property.


Any idea


From python console works, but I have one question more…How can I add this checkbox to a panel?

…something like this:

def draw(self, context):
        layout = self.layout

        row = layout.row()
        row.prop(context.space_data, "show_only_render", text="Hide controllers")
row.prop(context.user_preferences.themes[0],"gradients.show_grad", text="Gradient") ?????

Dang close

row.prop(context.user_preferences.themes[0], "show_grad", text="Gradient")

Thanks! :slight_smile: