Created
May 14, 2015 09:23
-
-
Save zeffii/2ee84e47872ff04bec94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import bpy | |
from mathutils import Color, Vector | |
current_theme = bpy.context.user_preferences.themes.items()[0][0] | |
texed = bpy.context.user_preferences.themes[current_theme].text_editor | |
theme_options = { | |
'space.text', | |
'space.back', | |
'cursor', | |
'syntax_builtin', # import, return, for, in.. | |
'syntax_comment', | |
'syntax_numbers', | |
'syntax_special', # def, class.. | |
'syntax_string', | |
'syntax_symbols', # = ()[] . , > < == etc. | |
'syntax_reserved', | |
'syntax_preprocessor', | |
'line_numbers_background', | |
'selected_text' | |
} | |
theme_dict = {} | |
for opt in theme_options: | |
if '.' in opt: | |
# assume only one dot. | |
prime, subprime = opt.split('.') | |
val = getattr(getattr(texed, prime), subprime) | |
else: | |
val = getattr(texed, opt) | |
# cant round a colour, convert to vector first. | |
regular_vec = Vector(val[:]) | |
# rounds the value after 7th decimal | |
theme_dict[opt] = regular_vec.to_tuple(7) | |
m = json.dumps(theme_dict, sort_keys=True, indent=2) | |
for key, val in theme_dict.items(): | |
print('texed.{0} = {1}'.format(key, val)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment