I am trying to write a script to set Interface colours for individual scenes. When I switch scenes in the Info bar drop down menu I want to change the Info Bar background colour. This gives better feedback for scene swapping/tracking. So far I've got bpy.context.user_preferences.themes[0].info.space.header = (1,0,0)

  • I guess I need to create an open list of scenes that I can append later.

  • Then allocate the spectrum of colours to it?

  • Not sure I can create a UI to allocate colours to scenes, so I'll have to bump the values in increments instead.

But first I'm stuck on calling the colour change (I considered iterating a bunch of themes and switching them as needed). At the BA forum it was suggested that the scene change is a frame change event but I'm not sure how to separate that from any other frame changes...

Hopefully if I can set up colours for the info bar I could tie them to node scene inputs.


Cool idea, I wrote this addon for me just now and I triggered the Header draw event. You can copy it from below or from here: scene_colored_header.py

EDIT: Updated to the newer Version. Don't use the old version, it generates a continuous redraw of the Header, wich I don' noticed. leads to cpu inceasement

the updated Version:

bl_info = {
           "name": "Colored Header for each scene",
           "author": "Leon95, Idea: 3pointedit",
           "version": (1, 1),
           "blender": (2, 68, 0),
           "location": "Properties > Scene Tab > Scene Panel > Display Color",
           "description": "Define a Header Color for every scene and display it in the Header",
           "category": "Scene"

import bpy

def_color = bpy.props.FloatVectorProperty(size = 3,min = 0.0,max = 1.0,
def_color = bpy.context.user_preferences.themes[0].info.space.header.copy()

def ui_properties_costum_header_color(self, context):
    row = self.layout.row()
    row.prop(context.scene, "headerColor")

def ui_info_header_refresh(self, context):
    #assign the property to the header theme every time it is redrawn
    ch = context.user_preferences.themes[0].info.space.header
    cs = context.scene.headerColor
    #check, if reassignment is needed, since  assigning a color leads to redraw
    #(which the causes some kind of stack overflow)
    if not (round(l_co[0],3) == round(cs[0],3) and round(l_co[1],3) == round(cs[1],3) and round(l_co[2],3) == round(cs[2],3)):
        bpy.context.user_preferences.themes[0].info.space.header = bpy.context.scene.headerColor

def register():
    co = bpy.context.user_preferences.themes[0].info.space.header.copy()
    bpy.types.WindowManager.lastHeaderColor=bpy.props.FloatVectorProperty(size = 3,min = 0.0,max = 1.0)
    bpy.types.Scene.headerColor = bpy.props.FloatVectorProperty(
                                     name = "Display Color",
                                     subtype = "COLOR",
                                     size = 3,
                                     min = 0.0,
                                     max = 1.0,
                                     update = ui_info_header_refresh,
                                     default = co)


    #reassigment forces redraw
    bpy.context.user_preferences.themes[0].info.space.header = bpy.context.user_preferences.themes[0].info.space.header

def unregister():
    bpy.context.user_preferences.themes[0].info.space.header = [def_color[0],def_color[1],def_color[2]]
    del bpy.types.WindowManager.lastHeaderColor

if __name__ == "__main__":
| improve this answer | |
  • $\begingroup$ The coolest thing is that you can animate the header color :) $\endgroup$ – Leon95 Aug 30 '14 at 20:57
  • 1
    $\begingroup$ +1 This is pretty sweet. A cool idea from op indeed, registered and currently using it. Only critique is by default the color changes are rather subtle. $\endgroup$ – iKlsR Aug 30 '14 at 21:04
  • $\begingroup$ That is AWESOME, thanks sooo much! At least now I have a script to learn from, win win. $\endgroup$ – 3pointedit Aug 31 '14 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.