Module Theme
[hide private]
[frames] | no frames]

Module Theme

source code

The Blender.Window.Theme submodule.


This module provides access to Theme objects in Blender.


 # this is a simplified version of the script
 # shipped with Blender:
 import Blender
 from Blender.Window import Theme, FileSelector

 theme = Theme.Get()[0] # get current theme

 def write_theme(filename):
   "Write the current theme as a BPython script"

   f = file(filename, "w")

   f.write("import Blender")
   f.write("from Blender.Window import Theme")
   f.write("theme = Theme.New('%s')" %

   for tsp in theme.get(): # write each theme space
     command = "\n%s = theme.get('%s')" % (tsp, tsp)
     f.write(command + "\n")
     exec("vars = dir(%s)" % tsp)

     for var in vars: # write each variable from each theme space
       v = "%s.%s" % (tsp, var)
       exec("value = %s" % v)
       f.write("%s = %s\n" % (v, value))

   f.write('\nBlender.Redraw(-1)') # redraw to update the screen

 FileSelector(write_theme, "Save Current Theme", default_fname)
Classes [hide private]
This object gives access to Themes in Blender.
This can be accessed with theme.get(t), where t can be 'ui' or -1.
There is a sub-theme for each space in Blender (except for the Scripts window, but it will be added soon).
Functions [hide private]
Blender Theme
New(name='New Theme', theme='<default>')
Create a new Theme object.
source code
Blender Theme or a list of Blender Themes
Get the Theme object(s) from Blender.
source code
Variables [hide private]
  __package__ = None
Function Details [hide private]

New(name='New Theme', theme='<default>')

source code 

Create a new Theme object.

  • name (string) - The name of the new theme.
  • theme (Blender Theme) - a base theme to copy all data from. It defaults to the current one.
Returns: Blender Theme
A new Blender Theme object.


source code 

Get the Theme object(s) from Blender.

  • name (string) - The name of the Theme object.
Returns: Blender Theme or a list of Blender Themes
It depends on the name parameter:
  • (name): The Theme object called name, None if not found;
  • (): A list with all Theme objects currently in Blender.