To enable color highlighting of mesh polygon orientation, we need to on the “Face Orientation” checkbox in the “Viewport Overlays” menu. To turn off the highlighting, we need to uncheck this checkbox. This can be done either manually or using the Blender Python API.
To turn on and off the polygon orientation highlighting, we need to change the value of the “show_face_orientation” property of the “overlay” object. To turn on the highlighting, we need to set this property to True.
|
1 |
bpy.context.space_data.overlay.show_face_orientation = True |
If we execute this command not from the 3D viewport, but from the context of another area, for example, the Text Editor, we will need to override the context.
First, get a pointer to the 3D viewport area:
|
1 2 3 |
area = [area for area in bpy.context.screen.areas if area.type == "VIEW_3D"][0] # bpy.data.screens['Layout']...Area |
And specify it in the temporary context override block.
First, to get the current value – to find out whether the color backlight is already on or not.
|
1 2 3 4 |
with bpy.context.temp_override(area=area): print(bpy.context.space_data.overlay.show_face_orientation) # False |
The False value means that the highlight is off (the checkbox is unchecked).
To turn on the highlight and on the checkbox, assign this property the value of True.
|
1 2 |
with bpy.context.temp_override(area=area): bpy.context.space_data.overlay.show_face_orientation = True |
As we can see visually, the checkbox is now checked and the back-oriented polygons are highlighted in red.
To turn the highlighting back off, we need to set this property to False in the same way.

.blend file on Patreon