Featured post

new redirect for blender.org bpy docs.

http://www.blender.org/api/blender_python_api_current/ As of 10/11 november 2015 we can now link to the current api docs and not be worr...

September 02, 2012

Color changes in UI ( theme, customize )

import bpy  
import struct  
  
current_theme = bpy.context.user_preferences.themes.items()[0][0]  
texed = bpy.context.user_preferences.themes[current_theme].text_editor  
  
def hex_to_rgb(rgb_str):  
    int_tuple = struct.unpack('BBB', bytes.fromhex(rgb_str))  
    return tuple([val/255 for val in int_tuple])  
      
  
texed.space.text = hex_to_rgb('ffffff')  
texed.space.back = hex_to_rgb('2a2a2a')
texed.cursor = hex_to_rgb('FFAAAA')
texed.syntax_builtin = hex_to_rgb('00EFFF') # import, return, for, in..  
texed.syntax_comment = hex_to_rgb('33df05')   
texed.syntax_numbers = hex_to_rgb('0093c8')  
texed.syntax_special = hex_to_rgb('f8ff35') # def, class..  
texed.syntax_string = hex_to_rgb('B2FFB0')
texed.syntax_symbols = hex_to_rgb('FFC5DF') # = ()[] . , > < == etc.
texed.syntax_reserved = hex_to_rgb('45eae4') 
texed.syntax_preprocessor = hex_to_rgb('FFFFFF')
  
texed.line_numbers_background = (0,0,0)  
texed.selected_text = (.4,.4,.4)  





No comments:

Post a Comment

Please use Blender.StackExchange.com for python scripting questions unrelated to this post.