2
$\begingroup$

How can you set Blender's Theme Preset with python?

I'm don't mean customize a few colors, I'm talking about loading one of the existing presets.

Is there a simple command I can run?

enter image description here

$\endgroup$
0

2 Answers 2

1
$\begingroup$

I found a way but I don't know it is right or wrong to do this way The way I did is - In the dropdown menu of themes just right click on the theme you want to change to and then another menu will appear > click on copy python command > and then paste that command in the console > and if you want to change the theme from the console you need to remember the theme name > you can change the name in the command where the file name is written (maya.xml, or modo.xml, etc).

Step 1-

step 1

Step 2-

step2

Step 3- Step3

Step 4- step 4

Step 5- Step 5

Step 6 -

Step 6

And in this way, you can change the theme from the console

$\endgroup$
1
$\begingroup$

Thanks to the other answer I figured this out. It does the same thing but it saves me from typing the entire path which was super long.

I have a script that defines some Blender defaults and since my theme's folder is in the same location I simply load it like this:

# Blender Setup Script

import bpy
import os

file_path = os.path.join(os.path.dirname(__file__),  # Path to this script.
    'armored_themes/armored_pink.xml')               # Relative path to the theme.

bpy.ops.script.execute_preset(
    filepath=file_path,
    menu_idname='USERPREF_MT_interface_theme_presets')
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .